Quickstart: Connect to Azure Government with PowerShell
Microsoft Azure Government delivers a dedicated cloud with world-class security and compliance, enabling US government agencies and their partners to transform their workloads to the cloud. To manage your Azure Government cloud workloads and applications you can connect to Azure Government using different tools, as described in the following video.
This quickstart shows how to use PowerShell to access and start managing resources in Azure Government. If you don't have an Azure Government subscription, create a free account before you begin.
This article has been updated to use the Azure Az PowerShell module. The Az PowerShell module is the recommended PowerShell module for interacting with Azure. To get started with the Az PowerShell module, see Install Azure PowerShell. To learn how to migrate to the Az PowerShell module, see Migrate Azure PowerShell from AzureRM to Az.
- Review Guidance for developers.
This article discusses Azure Government's unique URLs and endpoints for managing your environment. You must know about these endpoints in order to connect to Azure Government.
- Review Compare Azure Government and global Azure and click on a service of interest to see variations between Azure Government and global Azure.
Install PowerShell on your local machine. For more information, check out the Introduction to Azure PowerShell.
Specifying Azure Government as the environment to connect to
When you start PowerShell, you have to tell Azure PowerShell to connect to Azure Government by specifying an environment parameter. The parameter ensures that PowerShell is connecting to the correct endpoints. The collection of endpoints is determined when you connect log in to your account. Different APIs require different versions of the environment switch:
|Azure Active Directory commands||
|Azure (Classic deployment model) commands||
|Azure Active Directory (Classic deployment model) commands||
Get current regions
To list the available regions in Azure Government, run the following commands and print the current list:
Get-AzLocation Get-AzureLocation # For classic deployment model
The Azure Government region display names have no spaces between
DoD when using the
|Common Name||Display Name||Location Name|
|US Gov Virginia||
|US Gov Texas||
|US Gov Arizona||
|US DoD East||
|US DoD Central||
This quickstart showed you how to use PowerShell to connect to Azure Government. Once you are connected to Azure Government, you may want to explore Azure services. Make sure you check out the variations, described in Compare Azure Government and global Azure. To learn more about Azure services, continue to the Azure documentation.