承德微网站建设,网页ui设计的内容有哪些,广告制作网站,17一起做网店在我们使用PnP PowerShell的时候#xff0c;如果想使用自己的账户通过Connect-PnPOnline 连接Global SharePoint Online时是十分方便的#xff0c;可以通过一下几种方式
Credentials Connect-PnPOnline -Url contoso.sharepoint.com -Credentials (Get-Credenti…在我们使用PnP PowerShell的时候如果想使用自己的账户通过Connect-PnPOnline 连接Global SharePoint Online时是十分方便的可以通过一下几种方式
Credentials Connect-PnPOnline -Url contoso.sharepoint.com -Credentials (Get-Credential)UseWeblogin Connect-PnPOnline -Url contoso.sharepoint.com -UseWebLoginInteractive Connect-PnPOnline -Url contoso.sharepoint.com -Interactive
但是当我们使用21v的SharePoint Online时由于是独立部署在国内的版本上述方法只有UseWebLogin的方式还可以正常使用另外两种方式登录时会报错我猜测是国内外的认证链接存在差异所以还不支持。
那如果想要正常只用另外两种方式需要怎么做呢。PnP PowerShell文档实际上给出了方案。 方案的思路是在Azure ad中注册app然后赋予app对应的SharePoint权限然后app代理我们账户的权限来访问SharePoint。
#注册Azure ad app
Register-PnPAzureADApp -ApplicationName PnP PowerShell -Tenant contoso.partner.onmschina.cn -Interactive -AzureEnvironment China -SharePointDelegatePermissions AllSites.FullControl -SharePointApplicationPermissions Sites.FullControl.All -GraphApplicationPermissions Group.ReadWrite.All -GraphDelegatePermissions Group.ReadWrite.All
#在azure中赋与app权限后 即可正常使用如下cmdlet登录使用
Connect-PnPOnline https://contoso.sharepoint.cn/sites/dev/ -Interactive -ClientId [client id] -Tenant contoso.partner.onmschina.cn -AzureEnvironment ChinaAuthentication to GCC or National Cloud environments