編輯

共用方式為


Get started with Azure PowerShell

Azure PowerShell is a powerful tool for managing and administering Azure resources directly from PowerShell. It's ideal for building automated workflows and managing resources using the Azure Resource Manager model. You can try it out in your browser using Azure Cloud Shell or install it locally on your machine.

This article helps you get started with Azure PowerShell and teaches its core concepts.

Install or run in Azure Cloud Shell

The easiest way to try Azure PowerShell is through Azure Cloud Shell, a browser-based environment that requires no installation. To get started, see Get started with Azure Cloud Shell. Cloud Shell runs PowerShell on a Linux container, so Windows-specific features aren't available.

When you're ready to install Azure PowerShell locally, follow the steps in How to install Azure PowerShell.

Sign in to Azure

To sign in, use the Connect-AzAccount cmdlet. If you're using Cloud Shell, you can skip this step since you're already authenticated for your environment, subscription, and tenant.

Connect-AzAccount

Important

Beginning in early 2025, Azure PowerShell sign-ins using Microsoft Entra ID user identities for authentication require multi-factor authentication (MFA). For more information, see Planning for mandatory multi-factor authentication for Azure and other admin portals.

For regional environments that require specific compliance (e.g., Azure China 21Vianet), use the Environment parameter:

Connect-AzAccount -Environment AzureChinaCloud

Azure PowerShell defaults to Web Account Manager (WAM) for authentication on Windows systems, while other platforms use browser-based login. For more details, see Web Account Manager (WAM).

If you have access to multiple subscriptions, you’ll be prompted to select one upon login. Learn more about this process in Login experience.

Once signed in, you can use Azure PowerShell cmdlets to manage your resources. For further details on authentication, see Sign in with Azure PowerShell.

Find commands

Azure PowerShell cmdlets follow the standard PowerShell naming convention of Verb-Noun. The verb describes the action (e.g., New, Get, Set, Remove), while the noun represents the resource type (e.g., AzVM, AzKeyVaultCertificate, AzFirewall, AzVirtualNetworkGateway). Nouns in Azure PowerShell start with the prefix Az.

To discover commands, use the Get-Command cmdlet. For instance, to list all commands related to virtual machines:

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

Here’s a quick reference table of common resources and their associated modules:

Resource Type Azure PowerShell Module Noun Prefix
Resource Groups 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 complete list of Azure PowerShell modules, see the Azure PowerShell modules list hosted on GitHub.

Data collection

By default, Azure PowerShell collects telemetry data to improve user experience by identifying usage patterns and issues. No private or personal data is collected. However, you can opt-out using the Disable-AzDataCollection cmdlet if you prefer. For more information, see our privacy statement.

Quickstarts and tutorials

Get hands-on with Azure PowerShell through our guided tutorials:

Next steps

Explore more Azure PowerShell capabilities:

For additional help, connect with the community:

References