This PowerShell script will iterate through all of the Azure subscriptions and VMs you have access to get the following information:
- Subscription ID
- Resource Group Name
- VM Name
- Location
- Size
- OS Type (Windows or Linux)
- Power State
- Either run in an Azure Cloud Shell window or run
Connect-AzAccount
to login to Azure PowerShell - Run
.\Get-AllVMPowerState.ps1