久久久久久久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 超時)
主站蜘蛛池模板: 午夜天堂精品久久久久 | 国产欧美精品一区 | 天天噜天天干 | 青青艹在线视频 | 国产成人久久av免费高清密臂 | 精品毛片| 特黄特色大片免费视频观看 | 男女视频在线观看网站 | 中文字幕国产精品 | 国产精品爱久久久久久久 | 91大片| 国产我和子的乱视频网站 | 国产精品日韩高清伦字幕搜索 | 亚洲日韩中文字幕一区 | 国产精品国产精品国产专区不片 | 国产成人一区二区三区电影 | 99国产精品99久久久久久粉嫩 | 亚洲+变态+欧美+另类+精品 | 午夜伦理影院 | 日本三级电影在线免费观看 | 亚洲瑟瑟| 日韩一级免费观看 | 成人国产精品久久久 | 亚洲精品在线观看视频 | 青青久久av北条麻妃海外网 | 国产精品电影网 | av一区二区三区 | 视频在线一区 | 91极品视频| heyzo在线| 天天躁天天操 | 久久久国产精品入口麻豆 | 日本午夜视频 | 久久成人人人人精品欧 | 91素人| 三级成人在线 | 日韩欧美一区二区三区在线播放 | 国产成人综合亚洲欧美94在线 | www.天天操.com | 亚洲一区二区免费视频 | 免费在线性爱视频 |