azure-sdk-for-go icon indicating copy to clipboard operation
azure-sdk-for-go copied to clipboard

Document how to interact with sovereign/private clouds

Open jhendrixMSFT opened this issue 2 years ago • 6 comments

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 avatar Dec 13 '21 19:12 jhendrixMSFT

@jhendrixMSFT , I suggest adding one page in https://docs.microsoft.com/en-us/azure/developer/go/ for this work.

lirenhe avatar Dec 15 '21 05:12 lirenhe

+1 This would be really helpful

Sean-Holcomb avatar Feb 11 '22 21:02 Sean-Holcomb

The fits in nicely with the work that @chlowell did for the cloud package.

jhendrixMSFT avatar Feb 11 '22 23:02 jhendrixMSFT

@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 avatar Feb 11 '22 23:02 chlowell

@chlowell I see that azidentity for go has moved to stable. Is Azure Stack supported?

patrickdillon avatar Aug 05 '22 20:08 patrickdillon

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.

chlowell avatar Aug 05 '22 21:08 chlowell