【发布时间】:2021-12-28 07:57:29
【问题描述】:
从今天早上开始我就遇到了一个问题。我正在使用 Graph API for Powershell 创建 M365 组。直到昨天这工作正常。今天,如果我尝试创建一个新组,我会收到此错误:
New-MgGroup : Access token validation failure. Invalid audience.
+ CategoryInfo : InvalidOperation: ({ body = Micros...ftGraphGroup1 }:<>f__AnonymousType1`1) [New-MgGroup
_CreateExpanded], RestException`1
+ FullyQualifiedErrorId : InvalidAuthenticationToken,Microsoft.Graph.PowerShell.Cmdlets.NewMgGroup_CreateExpanded
我的脚本没有任何变化。我正在以这种方式生成令牌:
Connect-PnPOnline -Url https://tenant.sharepoint.com -Interactive
Connect-MgGraph -AccessToken (Get-PnPGraphAccessToken)
New-MgGroup
我检查了https://jwt.ms/ 上的令牌,它看起来很正常。观众是https://tenant.sharepoint.com
【问题讨论】:
-
我能够看到确切的错误,我认为这是意料之中的,因为访问令牌用于 sharpoint。这在创建组之前是否有效?之前在您的令牌中添加了哪些范围?
标签: powershell sharepoint microsoft-graph-api sharepoint-online