Pranav Raj
Pranav Raj

Reputation: 873

DevTestLab: Running sysprep artifact not deallocating the VM

I am running sysprep artifact on my VM through my code -

az lab vm apply-artifacts ...

It is showing up as succeeded when I check it from the portal. When I check more details about the artifact, it doesn't show me any error. The only extension message I see is:

/generalize /oobe /shutdown

Yet it is not deallocated. When I run sysprep again on the same VM from the portal, it works fine - the VM stops and gets deallocated.

Not sure what is happening or how to debug?

Upvotes: 0

Views: 295

Answers (1)

Steven Berkovitz
Steven Berkovitz

Reputation: 781

When a VM shuts down on its own, it is not deallocated - this is the expected behavior. The Stop button in the Azure portal shuts down the VM and deallocates it. If using PowerShell Stop-AzureRmVM, you can pass in the -StayProvisioned parameter to control this.

Upvotes: 0

Related Questions