![]() Follow the prompts to delete the virtual machine.įor more information on how to delete a virtual machine, see delete a VM.Select on "Delete" from the top middle option.Navigate to the virtual machine's Overview page on the left.If you no longer need the virtual machine, delete it with the following steps: The choice is used to set the -auto-shutdown-enabled property of the VMs. The -ids option is used to specify the VMs by their IDs, and the -time and -auto-start-enabled options are used to set the auto-shutdown and autostart properties, respectively.īoth scripts also prompt to choose whether to auto restart the machines or leave them off until they're manually restarted. The above scripts use the az vm auto-shutdown and az vm restart commands to set the auto-shutdown and restart properties of all the VMs in the specified resource group. # Loop through all VMs in the resource group and set the auto-shutdown and auto-start propertiesįor VM_ID in $(az vm list -g $RESOURCE_GROUP_NAME -query ".id" -o tsv) doĪz vm auto-shutdown -ids $VM_ID -time $SHUTDOWN_TIME To configure auto-shutdown for multiple virtual machines using the Azure CLI, you can use the following script: # Set the resource group name and shutdown timeĮcho "Do you want to auto-restart the machines? (y/n)" # Set the auto-shutdown and auto-start properties for the VMĪz vm auto-shutdown -g $RESOURCE_GROUP_NAME -n $VM_NAME -time $SHUTDOWN_TIMEĪz vm restart -g $RESOURCE_GROUP_NAME -n $VM_NAME -no-wait ![]() # Set the auto-shutdown and auto-start properties based on the user's choice # Prompt the user to choose whether to auto-restart or leave the machines offĮcho "Do you want to auto-restart the machine? (y/n)" To configure auto-shutdown for a single virtual machine using the Azure CLI, you can use the following script: # Set the resource group name, VM name, and shutdown time
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |