(Cloud) Tip of the Day: 5 Minute Warning for Reboot


Today’s Tip…

Ever wanted a 5min warning that Azure is about to reboot your IaaS VM? There’s an API for that now.

On the VM itself, run: Invoke-WebRequest -Uri http://169.254.169.254/metadata/v1/maintenance

This uses a special reserved IP address (kind of like localhost) that returns maintenance information.

The In-VM Metadata service allows a standard method to pull the maintenance status of that VM by executing the command:

clip_image001

The standard results set will include three main attributes: InstanceID, placement upgrade-domains and placement fault-domains. If an on-going maintenance activity is about to begin (within 5 minutes) an additional maintenance event will be added.

Normal Results:

clip_image002

Results when your VM is about to reboot:

clip_image003

Note: This does not appear to work on PaaS.

clip_image004

References:

“Preview: ‘What is about to happen to my VM?’ In-VM Notification Service” – https://azure.microsoft.com/en-us/blog/what-just-happened-to-my-vm-in-vm-metadata-service/

“Manage the availability of virtual machines” – https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-manage-availability/


Comments (0)

Skip to main content