Commands › SharePoint Online

Connect-SPOService

SharePoint Online Microsoft.Online.SharePoint.PowerShell Connect-*

Connects a SharePoint Administrator or SharePoint Embedded Administrator to the SharePoint admin center. You must run this cmdlet before running any other SharePoint Online cmdlets.

Quick start script

# Connect-SPOService — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-SPOService -Url https://$org-admin.sharepoint.com

# 2. Run and inspect
Connect-SPOService -AuthenticationUrl <String> -ClientId <String> -ManagedIdentity <SwitchParameter> | Format-List

# 3. Export for evidence / drift tracking
Connect-SPOService | Export-Clixml .\SPOService-$(Get-Date -Format yyyyMMdd).xml

Syntax — 4 parameter sets

AuthenticationCertificate

Connect-SPOService [-Url] <UrlCmdletPipeBind> [[-ClientTag] <String>] [-Region <AADCrossTenantAuthenticationLocation>] [-AuthenticationUrl <String>] [-Certificate <X509Certificate2>] [-CertificatePath <String>] [-CertificateThumbprint <String>] [-CertificatePassword <SecureString>] -ClientId <String> -TenantId <String> [<CommonParameters>]

AuthenticationLocation

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

AuthenticationManagedIdentity

Connect-SPOService -Url <UrlCmdletPipeBind> [-ClientTag <String>] [-ManagedIdentity] [-ManagedIdentityType <ManagedIdentityType>] [-ManagedIdentityClientId <String>] [<CommonParameters>]

AuthenticationUrl

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

Parameters (16)

ParameterTypeRequiredWhat it controls
-AuthenticationUrl String yes Specifies the URL for the Microsoft Entra cross-tenant authentication service. Use this parameter when a non-default cross-tenant authentication endpoint is required.
-Certificate X509Certificate2 Specifies the X.509 certificate used for authentication.
-CertificatePassword SecureString Specifies the password for the certificate file.
-CertificatePath String Specifies the path to the local `.pfx` certificate file.
-CertificateThumbprint String Specifies the thumbprint of the certificate in the current user's certificate store.
-ClientId String yes Specifies the client ID of the application.
-ClientTag String Optionally adds a client tag to CSOM HTTP traffic to help identify the calling script or solution.
-Credential CredentialCmdletPipeBind Specifies the credentials used to connect. If you do not provide credentials, you are prompted to enter them. The credentials must belong to an administrator who has access to the SharePoint admin center.
-ManagedIdentity SwitchParameter yes Indicates that the connection uses a managed identity instead of user or certificate‑based authentication.
-ManagedIdentityClientId String Specifies the client ID of a user‑assigned managed identity to use for authentication.
-ManagedIdentityType ManagedIdentityType Specifies the type of managed identity to use when authenticating. If not specified, the default managed identity type is used.
-ModernAuth Boolean Enables modern authentication when connecting to SharePoint administration cmdlets. When you use this parameter, you must also specify the `AuthenticationUrl` parameter.
-Region AADCrossTenantAuthenticationLocation Specifies the authentication region. Valid values are: `Default`, `ITAR`, `Delos`, `France`, `Germany`, and `China`. The default value is `Default`.
-TenantId String yes Specifies the ID of the tenant to connect to.
-Url UrlCmdletPipeBind yes Specifies the URL of the SharePoint admin center.
-UseSystemBrowser Boolean Uses the Microsoft Authentication Library (MSAL) to authenticate the user by using the system browser.

Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.