Azure PowerShell Documentation

What is Azure PowerShell?

Azure PowerShell is a set of cmdlets for managing Azure resources directly from the PowerShell command line. It provides a powerful scripting environment for automating tasks, deploying resources, and managing services.

Prerequisites

Getting Started

Install the Az module, connect to your Azure account, and start managing resources.

# Install the Az module (once)
Install-Module -Name Az -Repository PSGallery -Force

# Import the module
Import-Module Az

# Sign in to Azure
Connect-AzAccount

# Verify the subscription
Get-AzSubscription

Basic Commands

Below are some frequently used cmdlets.

# List all resource groups
Get-AzResourceGroup

# Create a new resource group
New-AzResourceGroup -Name MyResourceGroup -Location eastus

# Deploy an ARM template
New-AzResourceGroupDeployment -ResourceGroupName MyResourceGroup -TemplateFile .\template.json

# List virtual machines
Get-AzVM

# Start a VM
Start-AzVM -Name MyVM -ResourceGroupName MyResourceGroup

# Stop a VM
Stop-AzVM -Name MyVM -ResourceGroupName MyResourceGroup -Force

Next Steps