microsoftgraph / microsoftgraph/msgraph-sdk-go

cloud.Configuration support for endpoints (AzureChinaCloud, AzureGovernmentCloud, AzurePrivateCloud)

Open
#235 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go
Stars
335
Forks
43
Avg merge
15h 19m
Merged PRs (30d)
3

Description

instead of using adapter.SetBaseUrl("https://microsoftgraph.chinaclouapi.cn/v1.0") (related to #26) maybe adapt the way how the azure-sdk-for-go is using cloud.Configuration for configuring endpoints.

json representation of cloud.Configuration content for AzurePublicCloud:

{
    "activeDirectoryAuthorityHost": "https://login.microsoftonline.com/",
    "services": {
        "resourceManager": {
            "audience": "https://management.core.windows.net/",
            "endpoint": "https://management.azure.com"
        },
        // this could be the service configuration for msgraph-sdk-go
        "microsoftGraph": {
            "audience": "https://graph.microsoft.com",
            "endpoint": "https://graph.microsoft.com"
        }
    }
}

which is initialised here: https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/azcore/arm/arm.go

Inside the client creation (eg armresoruces, armauthorization, ...) the azure-sdk-for-go is using the AzurePublic endpoints by default and overwrites the endpoint if a cloud configuration is passed in the client options:

func NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error) {
	if options == nil {
		options = &arm.ClientOptions{}
	}
	ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint
	if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok {
		ep = c.Endpoint
	}

	// ....
}

see https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/resourcemanager/resources/armresources/zz_generated_client.go#L38

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the SDK's endpoint setup around adapter.SetBaseUrl and compare it with cloud.Configuration initialization in arm.go and the client-option handling in zz_generated_client.go. Done means the Go SDK can use AzureChinaCloud, AzureGovernmentCloud, and AzurePrivateCloud endpoints instead of assuming AzurePublicCloud defaults.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, go
Domain
api, cloud
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.