azure-sdk-for-go
azure-sdk-for-go copied to clipboard
Document how to interact with sovereign/private clouds
We support non-public clouds but don't have any docs/samples on how to connect to them. This comes up periodically and has been a pain-point in the past.
@jhendrixMSFT , I suggest adding one page in https://docs.microsoft.com/en-us/azure/developer/go/ for this work.
+1 This would be really helpful
The fits in nicely with the work that @chlowell did for the cloud
package.
@Sean-Holcomb Here's how to configure a client for a sovereign cloud with today's API:
// using armcompute v0.3.0 and azidentity v0.13.1
import (
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute"
)
cred, err := azidentity.NewDefaultAzureCredential(
// if a credential can be configured for a sovereign cloud,
// its options type has an "AuthorityHost" field
&azidentity.DefaultAzureCredentialOptions{AuthorityHost: azidentity.AzureChina},
)
// ARM client options have an "Endpoint" field
client := armcompute.NewVirtualMachinesClient(
"subscription-id",
cred,
&arm.ClientOptions{Endpoint: arm.AzureChina},
)
Private clouds aren't supported yet. #16942 shows a new API which will add private cloud support and, I hope, simplify cloud configuration in general. Not yet certain when that will ship. I'll update this issue when it does.
@chlowell I see that azidentity for go has moved to stable. Is Azure Stack supported?
Depends on the authentication provider for your Stack. azidentity supports Azure AD but not ADFS. We're tracking ADFS support with #14405.
I see I never came back to update this issue! Let me do that now: the PR I mentioned above shipped, and the current cloud configuration API is covered in the documentation for azcore/cloud. I'll leave this issue open because I agree with Renhe that it would be best to cover this on Microsoft Docs as well.