0

Azure Web Apps、データベース、ストレージ アカウントなどをセットアップするためのツールを作成しました。Wt は、一般的な Azure で非常にうまく機能します。ただし、今は同じことをAzure Chinaに適用したいと考えています。現在、API エンドポイントにアクセスするために、Active Directory からトークンを取得するための正しい URL を探しています。

私はこれらの指示に行きます: https://msdn.microsoft.com/en-us/library/azure/dn722415.aspx Azure のこれらの設定は完全に機能します:

oAuthAuthorizationEndpoint="https://login.microsoftonline.com/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/oauth2/authorize?api-version=1.0" apiEndpoint="https://management.core.windows.net/"

これらは、私が使用している Azure China の URL です。

oAuthAuthorizationEndpoint="https://login.chinacloudapi.cn/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/oauth2/authorize?api-version=1.0" apiEndpoint="https://management.core.chinacloudapi.cn/"

TokenCloudCredentials と上記の設定を使用して正常にログインできるようになりました。

this.Credentials = new TokenCloudCredentials(config.SubscriptionId, this.AuthenticationResult.AccessToken);
this.ResourceManagement = new ResourceManagementClient(this.Credentials, new Uri(config.ApiEndpoint));
var resourceGroups = this.ResourceManagement.ResourceGroups.ListAsync(new ResourceGroupListParameters(), CancellationToken.None).Result.ResourceGroups;
Console.WriteLine("ResourceGroupe: {0}", string.Join(", ", resourceGroups.Select(x => string.Format("{0}", x.Name)).ToArray()));

ただし、上記のように API にアクセスしようとするとすぐに、次の例外が発生します。 ForbiddenError: The server failed to authenticate the request. Verify that the certificate is valid and is associated with this subscription.

呼び出しによってスローされるのと同じ例外ですthis.ResourceManagement.Providers.RegisterAsync("Microsoft.Storage")

Azure China の管理 API を正常に使用できた人はいますか? どうやってそれをしましたか?

すべての Guid が有効で、すべてのアクセス許可が正しく設定されていることを確信しています。それを私の作業中のAzureの対応物と比較したので。

(ガイドは明らかにマスクされています)

4

0 に答える 0