Connect-MsolService
Initiates a connection to Azure Active Directory.
Syntax
Connect-MsolService
[-AzureEnvironment <AzureEnvironment>]
[<CommonParameters>]
Connect-MsolService
[-Credential <PSCredential>]
[-AzureEnvironment <AzureEnvironment>]
[<CommonParameters>]
Connect-MsolService
[-AdGraphAccessToken <String>]
[-MsGraphAccessToken <String>]
[-AzureEnvironment <AzureEnvironment>]
[<CommonParameters>]
Description
The Connect-MsolService cmdlet attempts to initiate a connection to Azure Active Directory. You must specify a credential, as a PSCredential object, or specify the CurrentCredentials parameter to use the credentials of the current user.
This cmdlet may return a warning or error if the version of the module is out of date.
Examples
Example 1: Initiate a connection
PS C:\> Connect-MsolService
This command attempts to initiate a connection with Azure Active Directory. Since no credential is provided, the cmdlet prompts you to enter your username and password.
Example 2: Initiate a connection by using a credential object
PS C:\> Connect-MsolService -Credential $Credential -AzureEnvironment AzureChinaCloud
This command attempts to initiate a connection to AzureChinaCloud with Azure Active Directory using the credential provided. The credential must be of the type PSCredential. To obtain a credential object, use the Get-Credential cmdlet.
Parameters
-AdGraphAccessToken
Specifies the AD Graph access token to use to connect to Azure Active Directory.
Type: | String |
Aliases: | AccessToken |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-AzureEnvironment
Specifies the deployment type to use to connect to Azure Active Directory in different region. Valid values are:
- AzureCloud
- AzureChinaCloud
- AzureGermanyCloud
- USGovernment
Type: | AzureEnvironment |
Position: | Named |
Default value: | AzureCloud |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Credential
Specifies the credential to use to connect to Azure Active Directory. To obtain a PSCredential object, use the Get-Credential cmdlet.
Type: | PSCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-MsGraphAccessToken
Specifies the MS Graph access token to use to connect to Azure Active Directory.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |