As a DevOps engineer, you need to automate the management of Azure virtual machines (VMs) based on their tags. Your task is to write a PowerShell script that uses the Azure CLI (az cli) to retrieve a list of all VMs in a subscription, check their tags, and perform specific operations based on the tags.
- Use the
az vm list
command to get a list of all VMs in the subscription. - For each VM, check the value of a specific tag (e.g.,
Environment
) to determine the environment it belongs to (Development
,Staging
, orProduction
). - Perform the following operations based on the environment tag:
- For VMs in the
Development
environment, stop the VM.