久久久久久久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 超時)
主站蜘蛛池模板: 久久久久一区二区三区四区 | 国产欧美一区二区三区久久手机版 | 国产综合精品一区二区三区 | 欧美高清hd | 亚洲国产精品久久 | 日韩一区二区三区在线 | 成人片在线看 | 天天爽夜夜操 | 99久久99| 免费在线黄色av | 日韩精品视频网 | 天天插日日操 | 久久久久国产一区二区三区 | 国产精品特级毛片一区二区三区 | 国产精品久久久久aaaa九色 | 亚洲欧美日韩电影 | 国产一区在线视频 | 日本在线一区二区 | 久久久久国产一区二区三区不卡 | 精品一区在线看 | 国产精品免费观看 | 亚洲视频一区在线播放 | 久久亚洲一区二区三区四区 | 伊人伊人伊人 | 久久久一区二区三区 | 成年免费大片黄在线观看一级 | 91亚洲欧美 | 国产精品视频久久久 | 成人精品一区二区三区中文字幕 | 久久6视频 | 国产高清精品一区二区三区 | 国产欧美精品 | 九九综合 | 天天草天天干 | 97人人超碰| 91精品久久久久久久久中文字幕 | 国产一级在线 | 69堂永久69tangcom| 午夜免费av | 亚洲精精品 | 国产精品99久久久久久久久 |