Powershell连接Office 365各组件的方法
参考: http://www.exchangecn.com/office365/20150108_540.html
MFA(双因子认证):https://technet.microsoft.com/en-us/library/mt811266(v=exchg.160).aspx
MFA-SFB: https://support.office.com/zh-cn/article/office-365-powershell-%E7%9A%84%E8%AE%BE%E7%BD%AE%E6%96%B9%E6%A1%88-6b2477de-2c07-4d5e-8061-a8a094c9a237?ui=zh-CN&rs=zh-CN&ad=CN#BMK_SKYPE
1. 适用于 IT 专业人员 RTW 的 Microsoft Online Services 登录助手
https://www.microsoft.com/en-us/download/details.aspx?id=41950
2. 用于 Windows PowerShell 的 Windows Azure Active Directory 模块 (History)
AdministrationConfig-zh-hans(1.0.9031.1): http://go.microsoft.com/fwlink/p/?linkid=236297
v1(1.1.166.0): https://docs.microsoft.com/en-us/powershell/msonline/v1/azureactivedirectory
v2: https://docs.microsoft.com/en-us/powershell/azuread/v2/azureactivedirectory
3. 适用于 Skype for Business Online 的 Windows PowerShell 模块
https://www.microsoft.com/en-US/download/details.aspx?id=39366
4. SharePoint Online Client Components SDK
https://www.microsoft.com/en-us/download/details.aspx?id=42038
5. SharePoint Online Management Shell
https://www.microsoft.com/en-us/download/details.aspx?id=35588
$pw = ConvertTo-SecureString 'password' -AsPlainText -Force
$creds = New-Object -Typename System.Management.Automation.PSCredential -Argumentlist 'abc@company.cn', $pw
1. Connect to Office 365
Connect-MsolService -Credential $creds
Verify: Get-MsolDomain
断开: Get-PSSession | Remove-PSSession
2. Connect to SharePoint
Connect-SPOService -Url https://company-admin.sharepoint.cn -Credential $creds
验证: Get-SPOSite
断开: Disconnect-SPOService
3. Connect to Exchange Online
$ExchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $creds -Authentication Basic -AllowRedirection
# 世纪互联版地址:https://partner.outlook.cn/PowerShell
Import-PSSession $ExchangeSession
断开: Remove-PSSession $ExchangeSession
4. Connect to Exchange Online Protection
$EOPSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid/ -Credential $creds -Authentication Basic -AllowRedirection
Import-PSSession $EOPSession
5. Connect to Lync
$LyncSession = New-CsOnlineSession -Credential $creds
Import-PSSession $LyncSession
断开: Get-PSSession | Remove-PSSession