Skip to main content
Connect Tenant
Updated this week

Command

Connect-Tenant

Description

The command to connect to a Microsoft 365 tenant to do a copy.

Note: At the moment, Connect-Tenant only works with Microsoft Teams PowerShell migrations.

Index

Examples

Connect to Microsoft 365 tenant with current user credentials

Connect-Tenant -Domain mytenantdomain

Note: Here, 'mytenantdomain' is the part before '.sharepoint.com' in the SharePoint URL. For example, 'https://mytenantdomain.sharepoint.com/sites/sitecollection'.

Connect to Microsoft 365 tenant with username

Connect-Tenant -Domain mytenantdomain -Username myusername

Connect to Microsoft 365 tenant with username and password

$mypassword = ConvertTo-SecureString 'mypassword' -AsPlainText -Force
$mytenant = Connect-Tenant -Domain mytenantdomain -Username myusername -Password $mypassword

Connect to Microsoft 365 tenant without single sign-on (SSO)

Connect-Tenant -Domain mytenantdomain -Browser -DisableSSO

Connect to Microsoft 365 tenant with proxy settings

$proxySettings = New-ProxySettings -Server myproxyserver -Port 888
Connect-Tenant -Domain mytenantdomain -ProxySettings $proxySettings

Connect to Microsoft 365 tenant using Browser Authentication

Connect-Tenant -Domain mytenantdomain -Browser

Connect to Microsoft 365 tenant using Browser Authentication with proxy settings

$proxySettings = New-ProxySettings -Server myproxyserver -Port 888
Connect-Tenant -Domain mytenantdomain -Browser -ProxySettings $proxySettings

Connect to Microsoft 365 tenant using existing tenant connection credentials

$connection = Connect-Tenant -Domain mytenantdomain -BrowserConnect-Tenant -Domain mytenantdomain -UseCredentialsFrom $connection

Connect to Microsoft 365 tenant using existing site connection credentials

$connection = Connect-Site -Url http://mytenantdomain/sites/mysitecollection -BrowserConnect-Tenant -Domain mytenantdomain -UseCredentialsFrom $connection

Syntax

Connect-Tenant-Domain <String>[-AddToExplorer <SwitchParameter>][-ProxySettings <ProxySettings>]
Connect-Tenant-Domain <String>-Credential <PSCredential>[-AddToExplorer <SwitchParameter>][-ProxySettings <ProxySettings>]
Connect-Tenant-Domain <String>-UserName <String>-Password <SecureString>[-AddToExplorer <SwitchParameter>][-ProxySettings <ProxySettings>]
Connect-Tenant-Domain <String>-UseCredentialsFrom <ConnectionEntity>[-AddToExplorer <SwitchParameter>]
Connect-Tenant-Domain <String>-Browser <SwitchParameter>[-AddToExplorer <SwitchParameter>][-DisableSSO <SwitchParameter>][-ProxySettings <ProxySettings>]

Parameters

-AddToExplorer <SwitchParameter>

Adds the connection to the ShareGate explorer.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-Browser <SwitchParameter>

Use browser authentication.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

Browser

Aliases

None

-Credential <PSCredential>

Specifies the credentials.

Required?

True

Default value

None

Accept pipeline input?

True (ByValue, ByPropertyName)

Accept wildcard characters?

False

Parameter set name

Credential

Aliases

None

-DisableSSO <SwitchParameter>

Disables the auto-login feature in order to connect to a Microsoft 365 site with another user account.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

Browser

Aliases

None

-Domain <String>

Sets the domain name of the Microsoft 365 tenant. The domain name is 'contoso' in this example: 'https://contoso.sharepoint.com/sites/sitecollection'.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-Password <SecureString>

Specifies the password. Use single quotation marks (') to pass the string to the command exactly as you type it.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

Manual

Aliases

None

-ProxySettings <ProxySettings>

Sets the proxy settings to connect to the SharePoint site.

Required?

False

Default value

None

Accept pipeline input?

True (ByValue, ByPropertyName)

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-UseCredentialsFrom <ConnectionEntity>

Use credentials from another connection.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

UseCredentialsFrom

Aliases

None

-UserName <String>

Specifies the username.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

Manual

Aliases

None

Did this answer your question?