Get-AzVM
Use Get-AzVM to retrieve Azure VM configuration and check power state with Status. See Az module requirements and examples.
Documentation: Microsoft Learn — Get-AzVM
Common usage
Get-AzVM -ErrorAction StopThis is a usage example, not the complete parameter-set reference. Follow Microsoft Learn below for supported parameters and version details.
See the command anatomy
Inspect this authored example with fictional data in the bounded browser model. The numbered stages show how its objects change.
Get-AzVM -ErrorAction Stop- Stage 1Get-AzVM
-ErrorAction
Try it
Browser simulation · fictional data; no changes to your computer.
Follow the objects
Run the command to inspect each stage.
Examples
Get-AzVM -ErrorAction Stop
Get-AzVM -ErrorAction StopShow reference output
Browser dataset output · the real environment will differ
Name ResourceGroupName PowerState ----- ----------------- ---------- web01 Web VM running
Practical use and troubleshooting
Practical scenario: Use Get-AzVM when you need to retrieve Azure VM configuration and check power state with Status. Start with one identified target and inspect the returned values before extending the operation to a list. Keep the identity in your report so you can trace each result back to the object or path that produced it.
Common error and fix: Power state missing from a model-view query requires an instance-view query using -Status. Inspect returned properties; a single named VM exposes status details differently from a subscription-wide list. In an unattended script, capture this failure with its original error record and record which target failed. An empty result and an unsuccessful query must remain distinguishable in the final report.
See also: Get-AzDisk. Get-AzVM describes virtual machines; Get-AzDisk describes managed disks. A VM's provisioning state is not its power state, and an unattached disk is not a stopped virtual machine. Read the linked command before substituting it; similar names do not imply identical inputs or output.
Put this command to work
Read Azure VM status
An Azure read context is preloaded in this fictional lab. Return the fictional Azure VM status inventory.
The sandbox is visible now. Sign in with Google only when you run or check a task; commands and temporary files are discarded when you leave.
Run a command to inspect its result.
Inspect starting data
Supported syntax
Virtual files
Recap
Get-AzVM Use Get-AzVM to retrieve Azure VM configuration and check power state with Status. See Az module requirements and examples.
Next: Get-AzDisk