共用方式為


Connect-SPOService

(SharePoint Online 管理中心) ,將 SharePoint Online 系統管理員連線至 SharePoint Online 連線。 必須先執行此 Cmdlet,才能執行任何其他 SharePoint Online Cmdlet。

語法

Connect-SPOService
       [-Url] <UrlCmdletPipeBind>
       [[-Credential] <CredentialCmdletPipeBind>]
       [[-ClientTag] <String>]
       [-AuthenticationUrl] <String>
       [[-ModernAuth] <Boolean>]
       [[-UseSystemBrowser] <Boolean>]
       [<CommonParameters>]
Connect-SPOService
       [-Url] <UrlCmdletPipeBind>
       [[-Credential] <CredentialCmdletPipeBind>]
       [[-ClientTag] <String>]
       [[-Region] <AADCrossTenantAuthenticationLocation>]
       [[-ModernAuth] <Boolean>]
       [[-UseSystemBrowser] <Boolean>]
       [<CommonParameters>]

Description

Connect-SPOService Cmdlet 會將 SharePoint Online 系統管理員或 SharePoint Embedded 系統管理員連線到 SharePoint Online 系統管理中心。

只會從任何單一 Windows PowerShell 會話維護單一 SharePoint Online 服務連線。 換句話說,這是組織系統管理員連線內的每個地理位置。 執行 Cmdlet Connect-SPOService 兩次會隱含地中斷先前的連線。 Windows PowerShell工作階段將會設定為指定的新 SharePoint Online 系統管理員提供服務。

委派的合作夥伴系統管理員必須為相同 Windows PowerShell 會話內的不同組織交換連線。

您必須是 SharePoint Online 系統管理員或 SharePoint Embedded 系統管理員,才能執行 Cmdlet。

如需有關適用於 SharePoint Online 的 Windows PowerShell 權限和最新資訊,請參閱位於 SharePoint Online Management Shell 簡介的線上文件。

範例

-----------------------範例 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.>

--------------------'---EXAMPLE 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

Microsoft Entra 跨租用戶驗證服務的位置。 如果使用非預設的跨租使用者驗證服務,則可以選擇性地使用。

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False
適用於:SharePoint Online

-ClientTag

允許將用戶端標籤附加至現有的用戶端標記。 選擇性地在 CSOM HTTP 流量中使用,以識別已使用的腳本或解決方案。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False
適用於:SharePoint Online

-Credential

指定要用來連接的認證。 如果未顯示任何認證,對話方塊會提示您輸入認證。 認證必須是可存取 SharePoint Online 管理中心網站的 SharePoint Online 系統管理員。

類型:CredentialCmdletPipeBind
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False
適用於:SharePoint Online

-ModernAuth

確保 SharePoint Online 租使用者管理 Cmdlet 可以使用新式 TLS 通訊協定連線到服務。

若要使用它,您也需要提供 AuthenticationUrl 參數。

類型:Boolean
Position:Named
預設值:False
必要:False
接受管線輸入:False
接受萬用字元:False
適用於:SharePoint Online

-Region

有效值為:預設值 |ITAR |德國 |中國

預設值為 「default」。。

注意:ITAR 值僅適用於 GCC High 和 DoD 租用。

類型:AADCrossTenantAuthenticationLocation
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False
適用於:SharePoint Online

-Url

指定 SharePoint Online 管理中心網站的 URL。

類型:UrlCmdletPipeBind
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False
適用於:SharePoint Online

-UseSystemBrowser

用來使用 MSAL Microsoft 驗證連結庫 (MSAL) 來驗證使用者。

類型:Boolean
Position:5
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False
適用於:SharePoint Online