加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

无法使用PowerShell连接到Office 365

发布时间:2020-12-14 00:35:56 所属栏目:Windows 来源:网络整理
导读:我想通过power shell连接到Office 365,这是一个非常简单的任务.但显然不适合我. 我想我错过了一个简单而重要的琐事. 一些信息: 许可证是Office 365 Buisness Essential Azure AD正在运行 我可以将powershell远程处理(WinRM)与其他服务器一起使用 我使用管理
我想通过power shell连接到Office 365,这是一个非常简单的任务.但显然不适合我.

我想我错过了一个简单而重要的琐事.

一些信息:

>许可证是Office 365 Buisness Essential
> Azure AD正在运行
>我可以将powershell远程处理(WinRM)与其他服务器一起使用
>我使用管理员帐户
>我使用我的域并尝试了onmicrosoft.com域
>配置双因素身份验证(附加安全验证)

我尝试了以下内容

PS C:&;Import-Module MSOnline
PS C:&;$msolcred = get-credential
PS C:&;connect-msolservice -credential $msolcred
connect-msolservice : The user name or password is incorrect. Verify your user name,and then type your password again.

PS C:&; $O365Session = New-PSSession -ConfigurationName Microsoft.Exchange 
    -ConnectionUri https://ps.outlook.com/powershell 
    -Credential $msolcred -Authentication Basic 
    -AllowRedirection
New-PSSession : [ps.outlook.com] Connecting to remote server ps.outlook.com failed with the following error message : Access is denied. For more information,see the about_Remote_Troubleshooting Help topic.

我使用了不同的连接uri

PS C:&; $Session = New-PSSession -ConfigurationName Microsoft.Exchange 
    -ConnectionUri https://outlook.office365.com/powershell-liveid/ 
    -Credential $msolcred2 -Authentication Basic 
    -AllowRedirection
New-PSSession : [outlook.office365.com] Connecting to remote server outlook.office365.com failed with the following error message :
[ClientAccessServer=VI1PR05CA0019,BackEndServer=,RequestId=5d73dec9-b3ee-4e71-9ddd-bdaac8f79998,TimeStamp=3/7/2015 8:17:50 AM] [FailureCategory=LiveID-InvalidCreds] Access Denied For more information,see the

非常感谢帮助!

它看起来不像PowerShell for O365支持双因素身份验证.

http://community.office365.com/en-us/f/148/t/222763.aspx

“如果管理员帐户启用了多重身份验证,则当PowerShell使用此管理员帐户连接到PowerShell时,PowerShell将无法正常工作.请确保使用强密码创建服务帐户以运行PowerShell脚本,并且不要为多重因素启用该帐户身份验证“.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读