错误验证凭据,因为在PowerShell中使用无效的用户名或密码。

huangapple go评论60阅读模式
英文:

Error validating credentials due to invalid username or password using PowerShell

问题

我想使用PowerShell v7进行Sharepoint身份验证,使用以下命令和属性URL站点和Sharepoint的凭据进行操作:

Connect-PnPOnline -Url $SiteURL -Credentials $Cred

但我收到了以下错误,即使我的帐户没有MFA:

错误验证凭据,因为在PowerShell中使用无效的用户名或密码。

英文:

I want to authenticate to sharepoint using PowerShell v7

and I'm using this command with attributes URL site and Credentials for Sharepoint

Connect-PnPOnline -Url $SiteURL -Credentials $Cred

to authenticate to SharePoint.

But I got this error even my account without MFA:

错误验证凭据,因为在PowerShell中使用无效的用户名或密码。

答案1

得分: 0

你可以尝试使用以下的 PnP PowerShell 脚本:

$SiteURL="https://Crescent.sharepoint.com"
$UserName="Salaudeen@thecrescenttech.com"
$Password = "password"
 
$SecurePassword = ConvertTo-SecureString -String $Password -AsPlainText -Force
$Cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $UserName, $SecurePassword
 
# 使用 PowerShell 连接到 SharePoint 在线站点
Connect-PnPOnline -Url $SiteURL -Credentials $Cred

参考链接:
使用 PnP PowerShell 连接到 SharePoint 在线

英文:

Hi you can try this PnP Powershell:

$SiteURL="https://Crescent.sharepoint.com"
$UserName="Salaudeen@thecrescenttech.com"
$Password = "password"
 
$SecurePassword = ConvertTo-SecureString -String $Password -AsPlainText -Force
$Cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $UserName, $SecurePassword
 
#connect to sharepoint online site using powershell
Connect-PnPOnline -Url $SiteURL -Credentials $Cred

Reference:
Connect to SharePoint Online using PnP PowerShell

huangapple
  • 本文由 发表于 2023年7月17日 19:50:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/76704163.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定