What are the changes necessary to be made in the Go SDK's API calls to make it work for Azure Govcloud

294 views Asked by At

I've used Go SDK for using deploying applications in Azure. I'm now planning to do the same for Azure Gov Cloud. Is there any change that has to be made in the calls from Compute, Storage, Network, Subscription client APIs to make it work for Azure Govcloud? For example for getting the list of locations, should there be any change in the API call arguments to make it work in GovCloud?

2

There are 2 answers

0
MarStr On

When interacting with sovereign clouds, which are often updated at a slower cadence than the Public cloud, you'll need to make sure that you choose API Versions which are available in your cloud. The Azure-SDK-for-Go has been specifically designed to facilitate this, putting API-Version in the path name.

In addition, as @Steve Michelotti pointed out, you'll want to inject the Government Environment so that the correct base URLs are used by the SDK.

0
Steve Michelotti On

Based on the documentation you should just be able to set the AZURE_ENVIRONMENT environment variable prior to calling the NewAuthorizerFromEnvironment() method. Set the value of this environment variable to: AZUREUSGOVERNMENTCLOUD.