I need an Azure CLI script file for the below requirements.
1. Verifying the Azure Subscription
2. Validating the VM's Tag Values
3. VM Status (Running / Deallocated)
4. if deallocated, run the VM.
I need an Azure CLI script file for the below requirements.
1. Verifying the Azure Subscription
2. Validating the VM's Tag Values
3. VM Status (Running / Deallocated)
4. if deallocated, run the VM.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Naimish MakwanaPosted Jan 5, 2024, 5:18 AM
Here is a basic Azure CLI script that should help you with your requirements. Please replace
,,, andwith your actual values.This script assumes that you’re already logged in to Azure CLI. If not, you’ll need to log in using
az loginbefore running this script. Also, please note that this is a basic script, and you might need to modify it according to your specific needs or handle errors and edge cases as necessary. Always test scripts in a safe environment before using them in production.Remember to replace
,,, andwith your actual values.is your Azure Subscription ID,is the name of the resource group where your VM is located,is the name of your VM, andis the name of the tag you want to validate.Thanks
Ali BenchaabanPosted Jan 4, 2024, 5:16 PM
Hello,
Regards,