第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

https://graph.microsoft.com/beta/applications

https://graph.microsoft.com/beta/applications

C#
慕的地6264312 2021-05-07 15:57:37
我試圖以編程方式將應(yīng)用程序角色添加到Azure Active Directory中的應(yīng)用程序注冊中,我使用以下Microsoft文章作為參考:https : //developer.microsoft.com/zh-cn/graph/docs/api-reference/ beta / api / application_update這是我的代碼:string bearer = "Bearer <token>";string appId = "<guid>";string appEndPoint = "https://graph.microsoft.com/beta/applications/{0}";HttpWebRequest request = (HttpWebRequest)WebRequest.Create(string.Format(appEndPoint, appId));request.Headers.Add("Authorization", bearer);request.Method = "PATCH";request.ContentType = "application/json";string jsonBody = "{\"appRoles\":[{\"allowedMemberTypes\":[\"User\"],\"description\":\"This is a test role\",\"displayName\":\"Test Role\",\"id\":\"fb3d0a97-b19e-4132-bb62-4a0213b37178\",\"isEnabled\":true,\"origin\":\"Application\",\"value\":\"Test\"}]}";request.ContentLength = Encoding.ASCII.GetBytes(jsonBody).Length;using (var streamWriter = new StreamWriter(request.GetRequestStream())){    streamWriter.Write(jsonBody);    streamWriter.Flush();    streamWriter.Close();}var responce = request.GetResponse(); // throws 403 Forbiddenvar responseStr = new StreamReader(responce.GetResponseStream()).ReadToEnd();這就是我獲取承載令牌的方式:string domain = "my.domain.com";string appId = "<guid>";string clientSecret = "<secret>";AuthenticationContext authContext = new AuthenticationContext(string.Format("https://login.windows.net/{0}/oauth2/token", domain));ClientCredential creds = new ClientCredential(appId, clientSecret);AuthenticationResult result = await authContext.AcquireTokenAsync("https://graph.microsoft.com/", creds);string bearer = result.AccessToken;我已為我的應(yīng)用程序注冊授予Microsoft文章中指定的所有必需權(quán)限,但我一直收到403響應(yīng)。我還嘗試向我的應(yīng)用程序注冊授予所有可用的權(quán)限,但仍然獲得403,有人知道我在這里做錯了嗎?
查看完整描述

2 回答

?
慕的地10843

TA貢獻(xiàn)1785條經(jīng)驗(yàn) 獲得超8個贊

“ Directory.ReadWrite.All”不是必需的,并且過大。某些服務(wù)原理api尚未遷移到新的圖形api。嘗試授予以下權(quán)限,您可能缺少的一個是Azure Active Directory圖權(quán)限

Azure Active Directory圖-請注意,這需要幾分鐘的時間才能應(yīng)用...

Application.ReadWrite.All

微軟圖

Application.ReadWrite.All


查看完整回答
反對 回復(fù) 2021-05-29
  • 2 回答
  • 0 關(guān)注
  • 203 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號