UPDATE: official documentation on how to do this can be found here
The Azure CLI provides a cross platform command line interface for working with Azure. If you are on Windows you might want to take a look at PowerShell, see Ryan’s post here on how to configure that.
- Install the CLI
- Follow the instructions here. Be sure to get the latest version of the CLI (later than 0.9.13). In this version we added the environment settings for Azure Gov (Environment name: "AzureUSGovernment")
- You have two options you can login with a username/password or you can login with a Publish Settings File
- If you choose username/password use the following command replacing your info
- If you choose Publish Settings File
Download the publish settings file for your Azure Government Subscription
- Using an InPrivate browser window, log into the Azure Government Management Portal
- Don't forget to use your something.onmicrosoft.com username and be sure to select "work or school account"
- After you have logged in navigate to the following URL in the same browser window. https://manage.windowsazure.us/publishsettings/index
- This will trigger the download of a file, you will need its name and location for the next step
- Connect it to your subscription
- Execute this command (replacing the path you downloaded publish settings file to and the name it was given)
You should now have access to everything via the CLI from any platform.