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

使用 azure Active Directory 進行身份驗證時調用 Azu

Error making Azure Management Library API call when authenticating with azure active directory(使用 azure Active Directory 進行身份驗證時調用 Azure 管理庫 API 時出錯)
本文介紹了使用 azure Active Directory 進行身份驗證時調用 Azure 管理庫 API 時出錯的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我的公司正在研究有關 Azure 的報告.我們只希望我們的客戶向我們提供只讀憑據以供我們使用.我做了一些研究,看起來 Azure Active Directory 就是這樣做的.所以我希望使用只讀的 Azure 目錄應用程序進行身份驗證.

為了讓我開始,我關注了這篇關于通過 Azure Active Directory 使用管理 API 的博客.

但是在此 UI 中,我無法為該屬性選擇任何值.我不確定這是錯誤還是未完成功能的結果.我在這里遺漏了什么嗎?

謝謝

這是我的完整代碼供參考:

類程序{靜態無效主要(字符串 [] 參數){var token = GetAuthorizationHeader();var credential = new TokenCloudCredentials(ConfigurationManager.AppSettings["subscriptionId"], token);使用 (var computeClient = new ComputeManagementClient(credential)){var images = computeClient.VirtualMachineOSImages.List();}}私有靜態字符串 GetAuthorizationHeader(){AuthenticationResult 結果 = null;var context = new AuthenticationContext("https://login.windows.net/" + ConfigurationManager.AppSettings["tenantId"]);字符串 clientId = ConfigurationManager.AppSettings["clientId"];字符串 clientSecret = ConfigurationManager.AppSettings["clientSecret"];ClientCredential clientCred = new ClientCredential(clientId, clientSecret);var thread = new Thread(() =>{結果 = context.AcquireToken("https://management.core.windows.net/",客戶信用);});線程.SetApartmentState(ApartmentState.STA);thread.Name = "AquireTokenThread";線程.Start();線程.Join();如果(結果 == 空){throw new InvalidOperationException("獲取 JWT 令牌失敗");}字符串令牌 = result.AccessToken;返回令牌;}}

已經取得了進展.正如我與 Gaurav 討論的那樣,我需要放棄 Azure 管理庫,因為目前它似乎不支持 Azure 資源管理器 (ARM) API!所以我做了原始的網絡請求.它按預期工作.如果我從我的 AD 應用程序中刪除角色訪問權限,我會被拒絕訪問.當我擁有它時,我會取回數據.

我不確定的一件事是讓我的應用程序自動添加到新資源中.

另外,有沒有辦法列出我的 AD 應用程序可以訪問的資源組?

新代碼:

 類程序{靜態無效主要(字符串 [] 參數){var token = GetAuthorizationHeader();string subscriptionId = ConfigurationManager.AppSettings["subscriptionId"];string resourceGroupName = ConfigurationManager.AppSettings["resourceGroupName"];var uriListMachines = string.Format("https://management.azure.com/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Compute/virtualmachines?api-version=2015-05-01-preview", 訂閱 ID, 資源組名);var t = WebRequest.Create(uriListMachines);t.ContentType = "應用程序/json";t.Headers.Add("授權", "承載" + token);var response = (HttpWebResponse)t.GetResponse();字符串結果 = "";使用 (var reader = new StreamReader(response.GetResponseStream())){結果 = reader.ReadToEnd();}//原始嘗試://var credential = new TokenCloudCredentials(ConfigurationManager.AppSettings["subscriptionId"], token);//使用 (var client = CloudContext.Clients.CreateComputeManagementClient(credential))//{//var images = client.VirtualMachineVMImages.List();/
                
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

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 超時)
主站蜘蛛池模板: 人人九九精 | 亚洲精品美女视频 | 久久久精品视频免费看 | 91麻豆蜜桃一区二区三区 | 成人福利视频网站 | 91麻豆精品国产91久久久久久久久 | 成人三级视频 | 一区二区三区免费网站 | 精品视频一区二区三区在线观看 | 美女黄18岁以下禁止观看 | 99热首页 | 中文字幕福利视频 | 欧美一区二区三区精品 | 黄网免费 | 最新av在线播放 | 日韩在线不卡视频 | 欧美一区在线视频 | 亚洲视频在线播放 | 久久国产精品视频观看 | 国产露脸国语对白在线 | 日韩欧美在线观看 | 黄色福利 | www.成人.com| 一区二区高清不卡 | 人人干97| 狠狠av | 欧美一级高清片 | 午夜视频一区二区三区 | 丝袜美腿av | 日韩三级免费观看 | 国产一级在线 | 国产精品第2页 | 国产91视频一区二区 | 国产精品日韩在线观看一区二区 | 永久av| 9999久久 | 日韩中文字幕一区二区 | 可以免费看的毛片 | 国产亚洲成av人片在线观看桃 | 羞羞的视频在线观看 | 久久久久91 |