Get-PnPUnifiedGroup:代码:Authorization_RequestDenied

时间:2018-10-19 15:23:23

标签: azure graph office365

如何使用此命令从图形获取统一组

$group = Get-PnPUnifiedGroup -Identity $sitetitle

然后我收到此错误:

  

Get-PnPUnifiedGroup:代码:Authorization_RequestDenied

尝试与租户用户建立联系

## know that this is not going to work
Connect-PnPOnline "https://$tenant-admin.sharepoint.com" -Credentia $cred

并使用具有所有图形权限的AADDomain

Connect-PnPOnline -AppId $appid -AppSecret $appsecret -AADDomain "$tenant.onmicrosoft.com"

还尝试使用证书..

Connect-PnPOnline -CertificatePath .\xxxxxcertkeyname.pfx -Tenant 'xxxxxxxxxxx.onmicrosoft.com' -ClientId 'xxxxxxx-xxxx-xxx-xxx-xxxxxx' -Url 'https://xxxxxxxx-admin.sharepoint.com' 

但是不能上班

1 个答案:

答案 0 :(得分:1)

您应该连接特定的范围

Connect-PnPOnline "https://$tenant-admin.sharepoint.com" -Scope "Group.Read.All" -Credentia $cred

-Scope "Group.Read.All"-Scope "Group.ReadWrite.All", "Directory.ReadWrite.All"(如果您打算更改任何组)

图形api的可用权限 https://github.com/microsoftgraph/microsoft-graph-docs/blob/master/concepts/permissions_reference.md