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 the 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.
Note
This article has been updated to use the new Azure PowerShell Az module. You can still use the AzureRM module, which will continue to receive bug fixes until at least December 2020. To learn more about the new Az module and AzureRM compatibility, see Introducing the new Azure PowerShell Az module. For Az module installation instructions, see Install Azure PowerShell.
Prerequisites
- 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
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:
Connection type | Command |
---|---|
Azure commands | Connect-AzAccount -EnvironmentName AzureUSGovernment |
Azure Active Directory commands | Connect-AzureAD -AzureEnvironmentName AzureUSGovernment |
Azure (Classic deployment model) commands | Add-AzureAccount -Environment AzureUSGovernment |
Azure Active Directory (Classic deployment model) commands | Connect-MsolService -AzureEnvironment UsGovernment |
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
Note
The Azure Government region display names have no spaces between US
and Gov
or US
and DoD
when using the Location
parameter.
Common Name | Display Name | Location Name |
---|---|---|
US Gov Virginia | USGov Virginia |
usgovvirginia |
US Gov Iowa | USGov Iowa |
usgoviowa |
US Gov Texas | USGov Texas |
usgovtexas |
US Gov Arizona | USGov Arizona |
usgovarizona |
US DoD East | USDoD East |
usdodeast |
US DoD Central | USDoD Central |
usdodcentral |
Next steps
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.
Feedback
Loading feedback...