0
我試圖使用C#.NET SDK獲取我的一個Web應用程序的配置。我想使用Azure AD應用程序而不是管理證書(我之前已經開始工作)。嘗試使用Azure .NET SDK獲取配置的異常
我有以下代碼:
var subscriptionId = "<subscription-guid>";
var appId = "<app-guid>";
var appKey = "<app-key>";
var tenantId = "<tenant-guid>";
var context = new AuthenticationContext("https://login.windows.net/" + tenantId);
ClientCredential clientCredential = new ClientCredential(appId, appKey);
var tokenResponse = context.AcquireTokenAsync("https://management.core.windows.net/", clientCredential).Result;
var accessToken = tokenResponse.AccessToken;
var myWebspace = "<my-webspace>";
var myWebsite = "<my-website>";
var client = new WebSiteManagementClient(new TokenCloudCredentials(subscriptionId, accessToken));
var config = client.WebSites.GetConfigurationAsync(myWebspace, myWebsite).Result;
...但它是扔在最後一行出現以下錯誤:
Microsoft.WindowAzure.CloudException
ForbiddenError: The server failed to authenticate the request. Verify that the certificate is valid and is associated with this subscription.
出了什麼問題?我已創建的應用程序,並給出了以下權限:
的Windows Azure服務管理
應用程序的權限:0
委託權限:1
訪問Azure的服務管理爲組織中的用戶(預覽)
Windows Azure Active Directory
應用權限:0
委託權限:1點
登錄和讀取用戶簡檔
預先感謝
克里斯
請參閱本主題爲你的錯誤的可能原因得到:http://stackoverflow.com/questions/35190866/error-making-azure-management-library-api-call-when-authenticating-with-azure-ac –
有沒有關於這個線程的日期? –