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 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.
Azure cloud services offer environments compliant with regional data-handling laws. For accounts in
a regional cloud, use the
Environment parameter to sign in. Get the name of the environment for
your region using the Get-AzEnvironment cmdlet.
For example, to sign in to Azure China 21Vianet:
Connect-AzAccount -Environment AzureChinaCloud
Beginning with Az PowerShell module version 5.0.0,
Connect-AzAccount presents an interactive
browser based login prompt by default. You can specify the
UseDeviceAuthentication parameter to
receive a token string which was previously the default for PowerShell version 6 and higher.
After signing in, you'll see information indicating which of your Azure subscriptions is active. If you have multiple Azure subscriptions in your account and want to select a different one, get your available subscriptions with Get-AzSubscription and use the Set-AzContext cmdlet with your subscription ID. For more information about managing your Azure subscriptions in Azure PowerShell, see Use multiple Azure subscriptions.
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.
Azure PowerShell cmdlets follow a standard naming convention for PowerShell,
Verb-Noun. The verb
describes the action (examples include
Remove) and the noun describes the
resource type (examples include
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 helps you find commands with
the Get-Command cmdlet. For example, to
find all VM-related commands that use the
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
|Resource type||Azure PowerShell module||Noun prefix|
For a full list of the modules in Azure PowerShell, see the Azure PowerShell modules list hosted on GitHub.
Azure PowerShell collects telemetry data by default. Microsoft aggregates collected data to identify patterns of usage to identify common issues and to improve the experience of Azure PowerShell. Microsoft Azure PowerShell does not collect any private or personal data. For example, the usage data helps identify issues such as cmdlets with low success and helps prioritize our work.
While we appreciate the insights this data provides, we also understand that not everyone wants to
send usage data. You can disable data collection with the
Disable-AzDataCollection cmdlet. You
can also read our privacy statement to learn more.
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:
- Create a storage account
- Transfer objects to/from Azure Blob storage
- Create and retrieve secrets from Azure Key Vault
- Create an Azure SQL database and firewall
- Run a container in Azure Container Instances
- Create a Virtual Machine Scale Set
- Create a standard load balancer
Prześlij i wyświetl opinię dla