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.

Note

We recommend that you use the Azure Az PowerShell module to interact with Azure. See Install Azure PowerShell to get started. To learn how to migrate to the Az PowerShell module, see Migrate Azure PowerShell from AzureRM to Az.

Prerequisites

  • Review Guidance for developers, which 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, including how to check your PowerShell version, see Install the Azure Az PowerShell module.

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 log in to your account. Different APIs require different versions of the environment switch.

Connect-AzAccount -Environment AzureUSGovernment

When you get prompted to sign in, enter your email address for the Azure Government environment.


Connect to Azure Government

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 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 feature variations and usage limitations, described in Compare Azure Government and global Azure. To learn more about Azure services, continue to the Azure documentation.

For more information about Azure Government, see the following resources: