首页 > 解决方案 > 获取 PnPUnifiedGroup:代码:Authorization_RequestDenied

问题描述

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

$group = Get-PnPUnifiedGroup -Identity $sitetitle

然后我得到这个错误:

获取 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' 

但是不能上班

标签: azuregraphoffice365

解决方案


你应该连接到一个特定的范围

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


推荐阅读