首页 > 系统相关 >Microsoft 365 开发:使用PnP Powershell连接SharePoint Online失败

Microsoft 365 开发:使用PnP Powershell连接SharePoint Online失败

时间:2022-12-26 19:04:40浏览次数:64  
标签:Management PnP SharePoint Shell Online 连接

Blog链接:​​https://blog.51cto.com/13969817​

今天小伙伴使用PnP Powershell连接SharePoint Online时,遇到如下错误:

ADSTS65001: The user or administrator has not consented to use the application with ID ‘31359c7f-bd7e-475c-86db-fdb8c937548e’ named ‘PnP Management Shell’. Send an interactive authorization request for this user and resource.

Microsoft 365 开发:使用PnP Powershell连接SharePoint Online失败_连接失败

解决方案:新的PnP.PowerShell模块使用ID为“31359c7f-bd7e-475c-86db-fdb8c937548e”的应用程序“PnP Management Shell”连接到SharePoint Online,如果要使用用户名和密码连接必须授予此PnP Management Shell应用程序权限。

具体操作步骤如下所示:

1.      以Global Administrator来执行Register-PnPManagementShellAccess,然后弹出的窗口中,勾选“Consent on behalf of your organization”,点击Accept,如下所示:

Microsoft 365 开发:使用PnP Powershell连接SharePoint Online失败_连接失败_02

2.      输入如下命令,就可以成功连接了。

$SiteURL= "https://Crescent.sharepoint.com/"  

$Cred= Get-Credential

Connect-PnPOnline-Url $SiteURL -Credentials $Cred


总结本文,希望给小伙伴提供排错方法,谢谢大家阅读。

标签:Management,PnP,SharePoint,Shell,Online,连接
From: https://blog.51cto.com/u_13969817/5970395

相关文章