Get started with Azure PowerShell

Azure PowerShell is designed for managing and administering Azure resources from the command line. Use Azure PowerShell when you want to build automated tools that use the Azure Resource Manager model. Try it out in your browser with Azure Cloud Shell, or install on your local machine.

This article helps you get started with Azure PowerShell and teaches the core concepts behind it.

Install or run in Azure Cloud Shell

The easiest way to get started with Azure PowerShell is by trying it out in an Azure Cloud Shell environment. To get up and running with Cloud Shell, see Quickstart for PowerShell in Azure Cloud Shell. Cloud Shell runs PowerShell 6 on a Linux container, so Windows-specific functionality isn't available.

When you're ready to install Azure PowerShell on your local machine, follow the instructions in Install the Azure PowerShell module.

Sign in to Azure

Sign in interactively with the Connect-AzAccount cmdlet. Skip this step if you use Cloud Shell: Your Azure Cloud Shell session is already authenticated for the environment, subscription, and tenant that launched the Cloud Shell session.

Connect-AzAccount

If you're in a non-US region, use the -Environment parameter to sign in. Get the name of the environment for your region by using the Get-AzEnvironment cmdlet. For example, to sign in to Azure China 21Vianet:

Connect-AzAccount -Environment AzureChinaCloud

You'll get a token to use on https://microsoft.com/devicelogin. Open this page in your browser and enter the token, then sign in with your Azure account credentials and authorize Azure PowerShell.

Once signed in, use the Azure PowerShell cmdlets to access and manage resources in your subscription. To learn more about the sign-in process and authentication methods, see Sign in with Azure PowerShell.

Find commands

Azure PowerShell cmdlets follow a standard naming convention for PowerShell, VERB-NOUN. The verb describes the action (examples include Create, Get, Set, Delete) and the noun describes the resource type (examples include AzVM, AzKeyVaultCertificate, AzFirewall, AzVirtualNetworkGateway). Nouns in Azure PowerShell always start with the prefix Az. For the full list of standard verbs, see Approved verbs for PowerShell Commands.

Knowing the nouns, verbs, and the Azure PowerShell modules available help you find commands with the Get-Command cmdlet. For example, to find all VM-related commands that use the Get verb:

Get-Command -Verb Get -Noun AzVM* -Module Az.Compute

To help you find common commands, this table lists the resource type, corresponding Azure PowerShell module, and noun prefix to use with Get-Command:

Resource type Azure PowerShell module Noun prefix
Resource group Az.Resources AzResourceGroup
Virtual machines Az.Compute AzVM
Storage accounts Az.Storage AzStorageAccount
Key Vault Az.KeyVault AzKeyVault
Web applications Az.Websites AzWebApp
SQL databases Az.Sql AzSqlDatabase

For a full list of the modules in Azure PowerShell, see the Azure PowerShell modules list hosted on GitHub.

Learn Azure PowerShell basics with quickstarts and tutorials

To get started with Azure PowerShell, try an in-depth tutorial for setting up virtual machines and learning how to query them.

There are also Azure PowerShell quickstarts for other popular Azure services:

Next steps