The full details of how to connect are listed in this MSDN article, however the connection information for Azure Government is a bit different then on the public cloud.
Connecting a two-step process, first you setup your credential and then you create your context. To connect to Azure Government you will need to take advantage of the following overloads:
// Create and cache the Media Services credentials in a static class variable.
_cachedCredentials = new MediaServicesCredentials(
// Use the cached credentials to create CloudMediaContext.
_context = new CloudMediaContext(new Uri(_apiServerAddress),
You get the account name and key via the Azure portal, just press the “Manage Keys” button.
The Media Context Scope should be set to "urn:WindowsAzureMediaServices".
The Acs Base Address should be set to "https://ams-usge-0-acs-global-1-1.accesscontrol.usgovcloudapi.net"
The API Server Address depends on what region you are deployed to:
US Gov Virginia is "https://ams-usge-1-hos-rest-1-1.usgovcloudapp.net/API/"
US Gov Iowa is "https://ams-usgc-1-hos-rest-1-1.usgovcloudapp.net/API/"