Overview
The Az.Compute module provides cmdlets for managing Azure compute resources such as virtual machines, VM scale sets, images, disks, and more. It is part of the larger Az PowerShell ecosystem.
- Fully cross‑platform (Windows, macOS, Linux)
- Supported for PowerShell 7.x and Windows PowerShell 5.1
- Automates provisioning, configuration, and lifecycle management
Key Features
- Create, start, stop, and deallocate virtual machines
- Manage VM extensions and custom script extensions
- Configure and scale VM scale sets
- Work with managed disks, snapshots, and images
- Support for Azure Spot VMs and low‑priority VMs
Installation
Run the following PowerShell command to install the module from the PowerShell Gallery:
Install-Module -Name Az.Compute -Repository PSGallery -ForceTo update the module later:
Update-Module -Name Az.ComputeGetting Started
Import the module and sign in to your Azure account:
Import-Module Az.Compute
Connect-AzAccountExample: Create a simple Windows VM:
New-AzVM `
    -ResourceGroupName "MyResourceGroup" `
    -Name "MyWinVM" `
    -Location "EastUS" `
    -VirtualNetworkName "MyVnet" `
    -SubnetName "MySubnet" `
    -SecurityGroupName "MyNSG" `
    -PublicIpAddressName "MyPublicIP" `
    -Image "Win2019Datacenter" `
    -Size "Standard_DS2_v2"