Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with creating image when other artifacts have been used #251

Closed
gregpakes opened this issue Jun 20, 2017 · 12 comments
Closed

Issue with creating image when other artifacts have been used #251

gregpakes opened this issue Jun 20, 2017 · 12 comments

Comments

@gregpakes
Copy link
Contributor

gregpakes commented Jun 20, 2017

I am deploying a VM with a number of artifacts. I am then trying to create an image of the VM. When I do that, another artifact is attempted to run which syspreps the VM. That artifact fails with the error:

Multiple VMExtensions per handler not supported for OS type 'Windows'. VMExtension 'customScriptArtifact-183362431' with handler 'Microsoft.Compute.CustomScriptExtension' already added or specified in input.

I have read up on this and found the following workaround:

https://blogs.technet.microsoft.com/meamcs/2016/01/30/run-two-powershell-scripts-on-a-same-vm-through-custom-script-extension-at-different-stage-of-deployment-in-arm/

This article suggests that I run the following command:

Remove-AzurermVMCustomScriptExtension -ResourceGroupName $ResourceGroupName -VMName $CustVMname –Name $customscriptname -Force

This is fine and I can work this into my workflow, but my question is:

How do I know what the $customscriptname parameter should be to pass into the command above?

I am using this in the context of the ImageFactory, so it's not just a case of manually looking up the extension that was used and then removing it. It needs to be automatable. In this case, the only extension applied to the VM is named: WinRMCustomScriptExtension

@gregpakes
Copy link
Contributor Author

This is a real blocker now. Our ImageFactory is no longer working.

@drwill-ms
Copy link

Hi Greg - Is this likely to be fixed by the PR you recently submitted?

@gregpakes
Copy link
Contributor Author

gregpakes commented Jun 25, 2017

@drwill-ms

No - I'm trying to resolve it, and only have a nasty hack at the moment.

@gregpakes
Copy link
Contributor Author

I am totally blocked by this now.

When I try to apply the sysprep artifact, I get the following error:

Multiple VMExtensions per handler not supported for OS type 'Windows'. VMExtension 'customScriptArtifact-183362431' with handler 'Microsoft.Compute.CustomScriptExtension' already added or specified in input.

@jaymarf
Copy link
Contributor

jaymarf commented Jul 18, 2017

Hi Greg- I am working on a repro for your issue right now, as far as your initial question you should be able to get the name from within the virtual machine.
Edit: Could you give me some more info about the machines? are you running a server version of Windows? how many artifacts are you installing? Are you using the sysprep artifact from the repo or are you using it as part of the dev test lab custom image creation work flow ?

@gregpakes
Copy link
Contributor Author

gregpakes commented Jul 18, 2017

@jaymarf

Thanks - I'll try to run through my scenario.

I think the issue is due to the fact I'm using the Azure File Copy task in VSTS. This task enables WinRm automatically and it achieves that through a custom script extension.

Logs from VSTS

2017-07-18T06:18:18.2209587Z ##[debug]Enabling winrm for virtual machine iSAMS-Img-1049
2017-07-18T06:18:18.2365587Z ##[debug]Adding custom script extension 'WinRMCustomScriptExtension' for virtual machine 'Img-1049'

I also think the sysprep task uses the WinRMCustomScriptExtension, so when it tries to apply, it fails.

I am using Windows 2016. I am applying the sysprep artifact through powershell

@jaymarf
Copy link
Contributor

jaymarf commented Jul 20, 2017

I will reach out to the team that owns the Azure File Copy task and talk to them about cleaning up their custom script extension after it has completed running. You can try running the powershell command that removes the custom script extension from the machine. It would look something like this $ExtensionName = Get-AzureRmVMExtension -ResourceGroupName $VM.ResourceGroupName -VMName $VM.Name -Name WinRMCustomScriptExtension Remove-AzureRmVMCustomScriptExtension -ResourceGroupName $VM.ResourceGroupName -VmName $VM.Name -Name $ExtensionName

@tanmayeekamath
Copy link
Contributor

We will be closing this issue. Please reopen if you are still seeing this error.

@adstep
Copy link

adstep commented Mar 30, 2019

I am still seeing this error.

@leovms
Copy link
Contributor

leovms commented Apr 1, 2019

Let me re-open the issue. We'll investigate further.

@leovms leovms reopened this Apr 1, 2019
@leovms
Copy link
Contributor

leovms commented Apr 9, 2019

@adstep, can you please provide steps to repro? We sysprep from Azure Portal. Are you using scripts to do this? If so, can you please share so we can troubleshoot further?

@leovms
Copy link
Contributor

leovms commented Apr 16, 2019

@adstep, closing this issue due to inactivity. If you wish to re-open the issue, please do so and provide the required steps to reproduce.

@leovms leovms closed this as completed Apr 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants