Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All


Published: March 22, 2013

Updated: July 30, 2015

Applies To: Azure, Office 365, Windows Intune

  • This topic provides online help content for cloud services, such as Microsoft Intune and Office 365, which rely on Microsoft Azure Active Directory for identity and directory services.

  • The Microsoft Azure Active Directory Module for Windows PowerShell cmdlets were previously known as the Microsoft Online Services Module for Windows PowerShell cmdlets.

The Connect-MsolService cmdlet will attempt to initiate a connection to the online service. The caller must provide their credential (a PSCredential object).

This cmdlet may return a warning or error if the version of the module is out of date.

Connect-MsolService [-Credential <PSCredential>] [<CommonParameters>]

    -Credential <PSCredential>
        The credential to use for connecting to Office 365.
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer and OutVariable. For more information, type,
        "get-help about_commonparameters".

There are a couple of ways that you can connect to the online service. The first is to simply run the cmdlet and you will be prompted for credentials. The second is to supply the credentials as a variable ($cred is used below) and then specify that variable when connecting. The following examples demonstrate further.

The following command attempts to initiate a connection. Since no credential is provided, the user is prompted to enter a username and password.


The following command attempts to initiate a connection to using the credential provided previously provided as $cred. The credential must be of the type PSCredential (typically retrieved through the Get-Credential cmdlet).

Connect-MsolService -Credential $cred

There are several other places you can get more information and help. These include:

See Also

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft