Skip to main content
Connect-MicrosoftOnline

Connect to your Microsoft 365 environment to copy mailboxes with PowerShell

Updated over 3 weeks ago

Command

Connect-MicrosoftOnline

Description

The command to connect to a Microsoft Online account to do a copy.

Examples

Connect using the browser

Connect-MicrosoftOnline

Note: When you run this command, you are prompted to log in to your Microsoft account using a web browser.

Connect using existing connection

Connect-MicrosoftOnline -TenantId 44a99b43-9521-470c-ad78-9375e86fdfa6 -UserId b9e3b106-2a8a-45cd-a761-48b46ec8d2d2

Connect using username and password

$mypassword = ConvertTo-SecureString "mypassword" -AsPlainText -Force
Connect-MicrosoftOnline -UserName "[email protected]" -Password $mypassword

Connect using credentials provider

$credentials = Get-Credential
Connect-MicrosoftOnline -Credentials $credentials

Syntax

Connect-MicrosoftOnline
Connect-MicrosoftOnline
-TenantId <String>
-UserId <String>

Parameters

-Credentials <PSCredential>

Specifies the credentials.

Required?

True

Default value

None

Accept pipeline input?

True (ByValue, ByPropertyName)

Accept wildcard characters?

False

Parameter set name

ConnectUsingPSCredentials

Aliases

None

-Password <SecureString>

Specifies the password.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

ConnectUsingCredentials

Aliases

None

-TenantId <String>

Specifies the tenant ID used to connect

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

ConnectUsingCache

Aliases

None

-UserId <String>

Specifies the user id used to connect

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

ConnectUsingCache

Aliases

None

-UserName <String>

Specifies the username.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

ConnectUsingCredentials

Aliases

None

Did this answer your question?