Does Stop-AzVM do a graceful shutdown or not?

Pete Horvath (Admin) 1 Reputation point
2022-08-25T17:50:07.537+00:00

I have several VMs that I'm using Stop-AZVM to shut down and deprovision at night to save resources and money. Recently I've had a few that did not come back online the next morning with a fatal patch error (fatal error C0000034 applying update.) I'm suspicious that the Stop-AZVM is not doing a graceful shutdown which is causing patch corruption when we turn the VMs on the next day.

How do shutdown my VMs and deallocate them at night while at the same time ensure they have a chance to wrap up any pre-shutdown patching work required?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,091 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Andreas Baumgarten 95,651 Reputation points MVP
    2022-08-25T18:05:53.223+00:00

    Hi @Pete Horvath (Admin) ,

    Stop-AzVM will do/try a graceful shutdown if you don't use the -SkipShutdown parameter:
    https://learn.microsoft.com/en-us/powershell/module/az.compute/stop-azvm?view=azps-8.2.0 -> See description of the -SkipShutdown` parameter here: https://learn.microsoft.com/en-us/powershell/module/az.compute/stop-azvm?view=azps-8.2.0#parameters

    A few days ago I ran in the error C0000034 issue on VM as well because the update was still running during shutdown or start phase of the VM and a Stop-AzVM was triggered.
    But I was able to fix the error C0000034 issue and decided to do the Windows Updates manually in the future ;-)

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    0 comments No comments