Getting Started with Azure Government

 Update - 4/4/2017 - 

 

This post is now redundant, all you have to use is the Environment Variable -->

 

Add-AzureAccount -Environment AzureUSGovernment

 

Yep ! Thats it :) For endpoint mapping - you can still use this reference or use Get-AzureEnvironment AzureUSGovernment to give you all the details

 

Original Article

If you are just getting started with Azure government, you would have realized by now, that there are a few things which needs to be changed in order to get it working exactly like how it did in Azure Public. To begin with here are a couple of things, I will keep updating this post as and when I stumble upon newer things which needs change in order to work with Azure Government

 

Azure Government PowerShell

 

To get started with managing Azure Government using PowerShell, you would need to make a couple of modifications before actually running the Import-AzurePublishingSettings file

  • Add-AzureEnvironment -name “AzureGovernment” -PublishSettingsFileUrl “https://manage.windowsazure.us/publishsettings/index?client=xplat” -ServiceEndpoint “https://management.core.usgovcloudapi.net” -ManagementPortalUrl “https://manage.windowsazure.us” -StorageEndpoint “core.usgovcloudapi.net” -ActiveDirectoryEndpoint “https://login.windows.net/” -ActiveDirectoryServiceEndpointResourceId “https://management.core.usgovcloudapi.net/” -ResourceManagerEndpoint “https://management.usgovcloudapi.net” -GalleryEndpoint “https://gallery.usgovcloudapi.net”  

  • Set-AzureEnvironment “AzureGovernment”

  • In order to download the publishing settings file, you would need to access the following URL - https://manage.windowsazure.us/publishsettings/index?client=xplat

  • Once you have run the first two commands and downloaded the publishing settings file, you should be good to run the Import-AzurePublishingSettings command

 

Endpoint Mapping

 

The endpoints are slightly different for Azure Government when compared to Azure Public. Please refer below for the mapping.

 

 

SERVICE TYPE AZURE PUBLIC AZURE GOVERNMENT
Management Portal manage.windowsazure.com manage.windowsazure.us
General *.windows.net *.usgovcloudapi.net
Core *.core.windows.net *.core.usgovcloudapi.net
Compute *.cloudapp.net *.usgovcloudapp.net
Blob Storage *.blob.core.windows.net *.blob.core.usgovcloudapi.net
Queue Storage *.queue.core.windows.net *.queue.core.usgovcloudapi.net
Table Storage *.table.core.windows.net *.table.core.usgovcloudapi.net
Service Management management.core.windows.net management.core.usgovcloudapi.net
SQL Database *.database.windows.net *.database.usgovcloudapi.net

 

 

 

For example, when trying to create a Storage context using PowerShell you would add the following switch –EndPoint:

 

 $endpointsuffix = "core.usgovcloudapi.net"

New-AzureStorageContext –StorageAccountName $sourceStorageAcc -StorageAccountKey $sourceStoragKey -Endpoint $endpointsuffix

Azure Media Services in Azure Government

In order to connect to Azure Media Services in Azure Government, the following changes need to be in place. All the below information can be retrieved when you click on Manage Keys under Azure Media Services.

While setting up the credentials:

Please do let me know if you have any questions in the comments section.

 

Good Luck

Anand Kumar R