使用 Powershell 通过基于证书的身份验证连接到 SharePoint Online

时间:2021-06-04 10:39:57

标签: powershell sharepoint x509certificate

我们可以使用基于证书的身份验证和 powershell 连接到 SharePoint Online 吗?有可能的?请分享。

下面是我的代码片段: 我现在正在使用凭据,我们可以使用证书吗?

$username = "test@testenvironment.onmicrosoft.com"
$password = "test123"
$secureStringPwd = $password | ConvertTo-SecureString -AsPlainText -Force 
$creds = New-Object System.Management.Automation.PSCredential -ArgumentList $username, $secureStringPwd

$AdminCenterUrl = "https://testenvironment-admin.sharepoint.com"
$SiteUrl = "https://testenvironment.sharepoint.com/sites/SharepointDemo2"
$SiteTitle = "SharePoint Demo2"
$siteOwner = "test@testenvironment.onmicrosoft.com"

#Connect SharePoint Online
Connect-SPOService -Url $AdminCenterUrl -Credential $creds

#Poershell to create new communication site
New-SPOSite -Url $SiteUrl -Owner $SiteOwner -Template "STS#3"  -Title $SiteTitle -StorageQuota 1048

0 个答案:

没有答案