Connect to Azure Germany by using PowerShell

Important

Since August 2018, we have not been accepting new customers or deploying any new features and services into the original Microsoft Cloud Germany locations.

Based on the evolution in customers’ needs, we recently launched two new datacenter regions in Germany, offering customer data residency, full connectivity to Microsoft’s global cloud network, as well as market competitive pricing.

Additionally, on Sept 30th, 2020, we announced that the Microsoft Cloud Germany would be closing on October 29th, 2021. More details are available here: https://www.microsoft.com/cloud-platform/germany-cloud-regions.

Take advantage of the breadth of functionality, enterprise-grade security, and comprehensive features available in our new German datacenter regions by migrating today.

To use Azure PowerShell with Azure Germany, you need to connect to Azure Germany instead of global Azure. You can use Azure PowerShell to manage a large subscription through a script or to access features that are not currently available in the Azure portal. If you have used PowerShell in global Azure, it's mostly the same. The differences in Azure Germany are:

  • Connecting your account
  • Region names

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.

Note

If you have not used PowerShell yet, check out Introduction to Azure PowerShell.

When you start PowerShell, you have to tell Azure PowerShell to connect to Azure Germany 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 to your account. Different APIs require different versions of the environment switch:

Connection type Command
Azure (classic deployment model) commands Add-AzureAccount -Environment AzureGermanCloud
Azure (Resource Manager deployment model) commands Connect-AzAccount -EnvironmentName AzureGermanCloud
Azure Active Directory (classic deployment model) commands Connect-MsolService -AzureEnvironment AzureGermanyCloud
Azure Active Directory (Resource Manager deployment model) commands Connect-AzureAD -AzureEnvironmentName AzureGermanyCloud

You can also use the Environment switch when connecting to a storage account by using New-AzStorageContext, and then specify AzureGermanCloud.

Determining region

After you're connected, there is one more difference: the regions that are used to target a service. Every Azure cloud service has different regions. You can see them listed on the service availability page. You normally use the region in the Location parameter for a command.

Common name Display name Location name
Germany Central Germany Central germanycentral
Germany Northeast Germany Northeast germanynortheast

Note

As is true with PowerShell for global Azure, you can use either the display name or the location name for the Location parameter.

If you ever want to validate the available regions in Azure Germany, you can run the following commands and print the current list. For classic deployments, use the first command. For Resource Manager deployments, use the second command.

Get-AzureLocation
Get-AzLocation

If you're curious about the available environments across Azure, you can run:

Get-AzureEnvironment
Get-AzEnvironment

Next steps

For more information about connecting to Azure Germany, see the following resources: