<meta name="google-site-verification" content="tZgbB2s-hTI0IePQQRCjHqL_Vf0j_XJmehXAHJerrn4" />
Microsoft Azure PowerShell
This repository contains a set of PowerShell cmdlets for developers and administrators to develop, deploy and manage Microsoft Azure applications.
Take a test run now from Azure Cloud Shell!
Below is a table containing the various Azure PowerShell rollup modules found in this repository. For a full list of modules found in this repository, please see the Azure PowerShell Modules page.
For more detailed instructions on installing Azure PowerShell, please refer to the installation guide.
Run the following command in an elevated PowerShell session to install the rollup module for Azure Resource Manager cmdlets:
Install-Module -Name AzureRM
To install the module containing the legacy RDFE cmdlets, run the following command in an elevated PowerShell session:
Install-Module -Name Azure
If you have an earlier version of the Azure PowerShell modules installed from the PowerShell Gallery and would like to update to the latest version, run the following commands in an elevated PowerShell session. Update-Module installs the new version side-by-side with the old version. It does not remove the old version.
# Update to the latest version of AzureRM Update-Module -Name AzureRM # Update to the latest version of Azure Update-Module -Name Azure
Web Platform Installer
Download and install the Microsoft Web Platform Installer. Once installed, open the program and search for Microsoft Azure PowerShell. Click the Add button followed by the Install button at the bottom to begin the installation process.
For more detailed instructions on using Azure PowerShell, please refer to the getting started guide.
Log in to Azure
To connect to Azure, use the
# Interactive login - you will get a dialog box asking for your Azure credentials Connect-AzureRmAccount # Non-interactive login - you will need to use a service principal Connect-AzureRmAccount -ServicePrincipal -ApplicationId "http://my-app" -Credential $PSCredential -TenantId $TenantId
To log into a specific cloud (AzureChinaCloud, AzureCloud, AzureGermanCloud, AzureUSGovernment), use the
# Log into a specific cloud - in this case, the Azure China cloud Connect-AzureRmAccount -Environment AzureChinaCloud
Getting and setting your session context
To view the context you are using in the current session, which contains the subscription and tenant, use the
# Get the context you are currently using Get-AzureRmContext # List all available contexts in the current session Get-AzureRmContext -ListAvailable
To get the subscriptions in a tenant, use the
# Get all of the subscriptions in your current tenant Get-AzureRmSubscription # Get all of the subscriptions in a specific tenant Get-AzureRmSubscription -TenantId $TenantId
To change the subscription that you are using for your current context, use the
# Set the context to a specific subscription Set-AzureRmContext -Subscription $SubscriptionName -Name "MyContext" # Set the context using piping Get-AzureRmSubscription -SubscriptionName $SubscriptionName | Set-AzureRmContext -Name "MyContext"
Get-Command cmdlet to discover cmdlets within a specific module, or cmdlets that follow a specific search pattern:
# View all cmdlets in the AzureRM.Profile module Get-Command -Module AzureRM.Profile # View all cmdlets that contain "VirtualNetwork" Get-Command -Name "*VirtualNetwork*" # View all cmdlets that contain "VM" in the AzureRM.Compute module Get-Command -Module AzureRM.Compute -Name "*VM*"
Cmdlet help and examples
To view the help content for a cmdlet, use the
# View the basic help content for Get-AzureRmSubscription Get-Help -Name Get-AzureRmSubscription # View the examples for Get-AzureRmSubscription Get-Help -Name Get-AzureRmSubscription -Examples # View the full help content for Get-AzureRmSubscription Get-Help -Name Get-AzureRmSubscription -Full # View the help content for Get-AzureRmSubscription on https://docs.microsoft.com Get-Help -Name Get-AzureRmSubscription -Online
Reporting Issues and Feedback
If you find any bugs when using the Azure PowerShell modules, please file an issue here, making sure to fill out the provided template with the appropriate information.
Alternatively, be sure to check out the Azure Support Community if you have trouble with any of the cmdlets or Azure services.
If you would like to become an active contributor to this project please follow the instructions provided in Microsoft Azure Projects Contribution Guidelines.