久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何通過 AAD 對 Azure 服務管理請求進行身份驗證

How to authenticate Azure Service Management Requests via AAD(如何通過 AAD 對 Azure 服務管理請求進行身份驗證)
本文介紹了如何通過 AAD 對 Azure 服務管理請求進行身份驗證的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我嘗試了 3 種方法都沒有結果:

I've tried 3 ways with no result:

  1. 根據這篇文章 https://msdn.microsoft.com/en-us/library/azure/ee460782.aspx 我已經在 AAD 中注冊了具有訪問 Azure 服務管理 API 權限的新 Web 應用程序(步驟 1-9)并編寫了推薦的兩行代碼來獲取令牌:
  1. According to this article https://msdn.microsoft.com/en-us/library/azure/ee460782.aspx I've registered new web application in AAD with permissions to Access Azure Service Management API (steps 1-9) and written the recommended two lines of code to acquire the token:

    var context = new AuthenticationContext($"https://login.windows.net/{tenantId}");
    var result = context.AcquireToken("https://management.core.windows.net/", clientId, new Uri(redirectUri));

,但它失敗了,異常:

Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException was unhandled
Message: An unhandled exception of type 'Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException' occurred in Microsoft.IdentityModel.Clients.ActiveDirectory.dll
Additional information: AADSTS90014: The request body must contain the following parameter: 'client_secret or client_assertion'.
Trace ID: aa2d6962-5aea-4f8e-bed4-9e83c7631887
Correlation ID: f7f1a61e-1720-4243-96fa-cff182150931

  1. 我也試過了:

    var context = new AuthenticationContext($"https://login.windows.net/{tenantId}");
    var result = context.AcquireToken("https://management.core.windows.net/", new ClientCredential(clientId, clientSecret));

其中 clientSecret 是我的應用程序的秘密應用程序密鑰.此版本返回一個令牌,但使用此令牌的請求返回 403 禁止:服務器未能驗證請求.驗證證書是否有效并與此訂閱相關聯.

where clientSecret is secret app key of my application. This version returns a token, but requests with this token returns 403 Forbidden:The server failed to authenticate the request. Verify that the certificate is valid and is associated with this subscription.

  1. 最后,我找到了 http://blogs.msdn.com/b/cloud_solution_architect/archive/2015/03/02/authenticating-azure-service-management-api-with-azure-ad-user-credentials.aspx,建議:

    var context = new AuthenticationContext(string.Format("https://login.windows.net/{0}", tenantId));

    // TODO: Replace with your Azure AD user credentials (i.e. admin@contoso.onmicrosoft.com)
    string user = "{YOUR-USERID]";
    string pwd = "{YOUR-USER-PASSWORD}";
    var userCred = new UserCredential(user, pwd);

    AuthenticationResult result =
    await context.AcquireTokenAsync("https://management.core.windows.net/", clientId, userCred);

但它也會失敗,與第一種情況相同......

but it also fails with the same exception as in the first case...

你能幫幫我嗎?

推薦答案

在 Azure 門戶中創建應用程序時,應將應用程序類型"更改為本地客戶端應用程序".

You should change the "Application Type" to "NATIVE CLIENT APPLICATION" while creating the application in the Azure portal.

這篇關于如何通過 AAD 對 Azure 服務管理請求進行身份驗證的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

ASP.NET Core authenticating with Azure Active Directory and persisting custom Claims across requests(ASP.NET Core 使用 Azure Active Directory 進行身份驗證并跨請求保留自定義聲明)
ASP.NET Core 2.0 Web API Azure Ad v2 Token Authorization not working(ASP.NET Core 2.0 Web API Azure Ad v2 令牌授權不起作用)
ASP Core Azure Active Directory Login use roles(ASP Core Azure Active Directory 登錄使用角色)
How do I get Azure AD OAuth2 Access Token and Refresh token for Daemon or Server to C# ASP.NET Web API(如何獲取守護進程或服務器到 C# ASP.NET Web API 的 Azure AD OAuth2 訪問令牌和刷新令牌) - IT屋-程序員軟件開發技
.Net Core 2.0 - Get AAD access token to use with Microsoft Graph(.Net Core 2.0 - 獲取 AAD 訪問令牌以與 Microsoft Graph 一起使用)
Azure KeyVault Active Directory AcquireTokenAsync timeout when called asynchronously(異步調用時 Azure KeyVault Active Directory AcquireTokenAsync 超時)
主站蜘蛛池模板: 欧美群妇大交群中文字幕 | 99久久国产免费 | 国产精品久久久久免费 | 男人电影天堂 | 亚洲在线一区 | 伊人精品在线 | 91久色 | 国产日韩一区二区 | 亚洲精品一区在线观看 | 高清成人av | 欧美激情久久久 | 日韩在线欧美 | 国内精品久久久久 | 亚洲一区二区三区四区在线观看 | 狠狠骚 | 国产美女永久免费无遮挡 | 久久合久久| 久久久久国产 | 亚洲欧美综合精品久久成人 | 视频在线一区二区 | 久久精品视频网站 | 久久久久久久香蕉 | 欧美色综合一区二区三区 | 在线看黄免费 | 国产a一区二区 | 欧美成年人网站 | 午夜色婷婷 | www日日日 | 秋霞av国产精品一区 | 国产成人午夜电影网 | 午夜丰满少妇一级毛片 | 国产精品高清在线 | 久久精品小视频 | 欧美一区二区三区在线 | 国产成人免费视频网站高清观看视频 | 日韩一二三区视频 | 成人三级视频 | 手机日韩 | 日韩精品在线看 | 国产极品粉嫩美女呻吟在线看人 | 福利视频一区二区三区 |