Microsoft announced today the Azure Virtual Machine API/SDK has been updated with the ability to skip a graceful shutdown when using the stop command. This can be useful to hard power down an Azure virtual machine when necessary and willing to risk data loss or corruption. Here is a quick walk-through using the Azure CLI.
Install the Azure Command-Line Interface (CLI).
Note: you could also use the Azure Cloud Shell, which does not require any install, but it will require an Azure Storage Account to use.
Once installed, run PowerShell as Administrator.
Run the command:
The command will launch a browser – Login with your Azure Account.
If you have multiple Azure subscriptions you can set the subscription with the command:
az account set --subscription "YOURSUBSCRIPTIONNAME"
Now run the shutdown command with the new skipShutdown flag:
az vm stop --resource-group YOUR_RESOURCE_GROUP --name YOUR_VM_NAME --skip-shutdown
Command details here.
Note: This stops the VM but does not deallocate it so you will still accrue charges. Alternatively, use the az vm deallocate command.
The API command is as follows: