本文介绍了Powershell Connect-MsolService无法使用Microsoft Graph访问令牌进行身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞!我正在尝试使用  Connect-MsolService对MSOnline powershell模块进行身份验证。我使用Azure AD Graph(graph.windows.net)通过Web应用程序获取用户的访问令牌。如果我使用该令牌进行身份验证( Connect-MsolService -AccessToken< token> ),一切正常。I am trying to authenticate with the MSOnline powershell module using Connect-MsolService. I obtain a user's access token via a web application using the Azure AD Graph (graph.windows.net). If I authenticate with that token (Connect-MsolService -AccessToken <token>), things work fine.但是,因为建议使用使用较新的Microsoft Graph(graph.microsoft.com)我想切换到它,但Connect-MsolService失败并带有它授予的令牌。如果我运行  Connect-MsolService -MsGraphAccessToken< token> ,我收到以下错误: However, since it's recommended to use the newer Microsoft Graph (graph.microsoft.com) I want to switch over to it, but the Connect-MsolService fails with the token granted by it. If I run Connect-MsolService -MsGraphAccessToken <token>, I get the following error: Connect-MsolService : The given key was not present in the dictionary.要获取访问令牌,我将用户发送到https://login.windows.net/common / oauth2 /授权使用正确的客户端ID,redirect_uri和资源设置为  https://graph.microsoft.com的终点。验证成功,我收到有效的令牌(例如,对https://graph.microsoft.com/v1.0/me的请求正常工作)。 To obtain the access token, I send users to the https://login.windows.net/common/oauth2/authorize end point with the correct client id, redirect_uri and resource set to https://graph.microsoft.com. The authentication succeeds and I get a valid token back (for example, a request to https://graph.microsoft.com/v1.0/me works fine). 我在这里做错了什么?感谢您的帮助!最好, 史蒂文Best,Steven推荐答案 我们建议你打开一个  技术支持票  我们的工程师仔细查看问题并为您提供适当的帮助。We would suggest you to open a Technical Support ticket for our engineers to have a closer look at the issue and assist you appropriately. 确保安装了最新的Azure AD powershell模块。Make sure that you have the latest Azure AD powershell module installed as well. 这篇关于Powershell Connect-MsolService无法使用Microsoft Graph访问令牌进行身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-20 08:19
查看更多