How Do I Connect to Microsoft 365 via PowerShell

Applies to: Nerdio for Azure (NFA) Professional and Enterprise and Core.

Refer this KB article to determine if you are a NFA user.

The following article is useful when there is a need to run remote PowerShell commands for Microsoft 365.  To do this simply follow the steps below: 

Preparing your PowerShell environment

There are two local modules that need to be installed before you run the command to connect to Microsoft 365.  Install the following via PowerShell if they have not been previously installed already.

Install-Module -Name AzureAD

Install-Module MSOnline

The context of this can be found in the following link -

Connecting to Microsoft 365

Open PowerShell and execute the following command: 


When you run the "Connect-MsolService" command, you will get the prompt from Microsoft where you can input the global admin credentials for that account. Once completed the Microsoft 365 account should successfully be connected to allow additional PowerShell commands. 

Was this article helpful?

0 out of 0 found this helpful
Have more questions? Submit a request

Comments (0 comments)

Article is closed for comments.