Connecting to Azure AD using Powershell

Connecting to Azure AD using Powershell

You are here:
Estimated reading time: < 1 min

This KB will cover how to connect to Office 365 (Azure AD) using Powershell. 

 

Module Installation

  1. Launch Powershell as a Administrator and the following Modules
    1. MSOnline
    2. AzureAD

Commands:

Install-Module -Name MSOnline
Install-Module -Name AzureAD

If you receive a message about installing from an untrusted repository, ensure that it refers to the PSGallery repository, then enter Y

Connect Powershell to Microsoft 365

  1. Create a Credential Object

    Command:
    $Creds = Get-Credential

    You will be promoted to enter your Microsoft 365 admin credentials and click on OK

  2.  To connect to the Azure Active Directory Module for Windows PowerShell or MSOnline module, use the Connect-MsolService cmdlet and supply the $creds variable.

    Connect-MsolService -Credential $creds

Verify Your Connection


If PowerShell makes a successful connection using the MSOnline module, the windows will not prompt any information. To verify the connection, please run the following command. 

Get-MsolCompanyInformation

 

Still Need Help? Open a Ticket

Let one of our experienced engineer resolve the issue

Was this article helpful?
Dislike 0