Connect-SPOService
将 SharePoint Online 管理员或 SharePoint 嵌入式管理员连接到 SharePoint Online 连接 (SharePoint Online 管理中心) 。 必须先运行此 cmdlet,然后才能运行任何其他 SharePoint Online cmdlet。
语法
AuthenticationLocation
Connect-SPOService
-Url <UrlCmdletPipeBind>
[-Credential <CredentialCmdletPipeBind>]
[-ClientTag <String>]
[-Region <AADCrossTenantAuthenticationLocation>]
[-ModernAuth <Boolean>]
[-UseSystemBrowser <Boolean>]
[<CommonParameters>]
AuthenticationUrl
Connect-SPOService
-Url <UrlCmdletPipeBind>
-AuthenticationUrl <String>
[-Credential <CredentialCmdletPipeBind>]
[-ClientTag <String>]
[-ModernAuth <Boolean>]
[-UseSystemBrowser <Boolean>]
[<CommonParameters>]
说明
cmdlet Connect-SPOService
将 SharePoint Online 管理员或 SharePoint Embedded Administrator 连接到 SharePoint Online 管理中心。
仅从任何单个Windows PowerShell会话维护单个 SharePoint Online 服务连接。
换句话说,这是组织管理员连接内的每个地理位置。
Connect-SPOService
运行 cmdlet 两次会隐式断开上一个连接。
Windows PowerShell会话将设置为为指定的新 SharePoint Online 管理员提供服务。
委派的合作伙伴管理员必须在同一Windows PowerShell会话中交换不同组织的连接。
您必须是 SharePoint Online 管理员或 SharePoint Embedded Administrator 才能运行 cmdlet。
有关适用于 SharePoint Online 的 Windows PowerShell 的权限和最新信息,请参阅在线文档简介 SharePoint Online 命令行管理程序的简介。
示例
示例 1
Connect-SPOService -Url https://contoso-admin.sharepoint.com -credential admin@contoso.com
示例 1 显示了具有凭据 admin@contoso.com 的 SharePoint Online 管理员如何连接到具有 URL 的 SharePoint Online 管理中心 <https://contoso-admin.sharepoint.com.>
示例 2
$username = "admin@contoso.sharepoint.com"
$password = "password"
$cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $userName, $(convertto-securestring $Password -asplaintext -force)
Connect-SPOService -Url https://contoso-admin.sharepoint.com -Credential $cred
示例 2 显示具有用户名和密码的 SharePoint Online 管理员如何连接到具有 URL 的 SharePoint Online 管理中心 <https://contoso-admin.sharepoint.com.>
示例 3
Connect-SPOService -Url https://contoso-admin.sharepoint.com
提示凭据。 如果帐户使用多重身份验证,则这是必需的。
示例 4
Connect-SPOService -Url https://contoso-admin.sharepoint.com -Region ITAR
连接到指定区域的 SharePoint Online 管理中心。
示例 5
Connect-SPOService -Credential $creds -Url https://tenant-admin.sharepoint.com -ModernAuth $true -AuthenticationUrl https://login.microsoftonline.com/organizations
使用 ModernAuth 标志连接到 SPO 服务。
示例 6
Connect-SPOService -Url https://contoso-admin.sharepoint.com -UseSystemBrowser $true
使用 Microsoft 身份验证库 (MSAL) 进行身份验证,并在身份验证成功后连接到 SharePoint Online 管理中心。
参数
-AuthenticationUrl
适用:SharePoint Online
Microsoft Entra跨租户身份验证服务的位置。 如果使用非默认的跨租户身份验证服务,则可以选择使用。
参数属性
类型: | System.String |
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
AuthenticationUrl
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-ClientTag
适用:SharePoint Online
允许将客户端标记追加到现有客户端标记。 (可选)在 CSOM http 流量中使用,以标识使用的脚本或解决方案。
参数属性
类型: | System.String |
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-Credential
适用:SharePoint Online
指定用于连接的凭据。 如果未提供凭据,则将出现一个提示输入凭据的对话框。 凭据必须是可以访问 SharePoint Online 管理中心网站的 SharePoint Online 管理员的凭据。
参数属性
类型: | Microsoft.Online.SharePoint.PowerShell.CredentialCmdletPipeBind |
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | True |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-ModernAuth
适用:SharePoint Online
确保 SharePoint Online 租户管理 cmdlet 可以使用新式 TLS 协议连接到服务。
若要使用它,还需要提供 AuthenticationUrl 参数。
参数属性
类型: | System.Boolean |
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-Region
适用:SharePoint Online
有效值为:Default |ITAR |德国 |中国
默认值为“default”。
注意:ITAR 值仅适用于 GCC High 和 DoD 租赁。
参数属性
类型: | Microsoft.Online.SharePoint.PowerShell.AADCrossTenantAuthenticationLocation |
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
AuthenticationLocation
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-Url
适用:SharePoint Online
指定 SharePoint Online 管理中心网站的 URL。
参数属性
类型: | Microsoft.Online.SharePoint.PowerShell.UrlCmdletPipeBind |
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | Named |
必需: | True |
来自管道的值: | True |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-UseSystemBrowser
适用:SharePoint Online
用于使用 Microsoft 身份验证库 (MSAL) 对用户进行身份验证。
参数属性
类型: | System.Boolean |
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
CommonParameters
此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters。