powershell 6 and 7 azure AD and msonline module

Hi All,
I want to upgrade to powershell 6 or 7 but run into problems when I want to install the azureAD and msonline modules.
I’ve been looking around on the internet to find solutions but at this point I understand that these modules are not compatible with powershell 6/7 is there a way to get these working or can you point me in the right direction for the newer modules.

I’m also exploring to work with visual studio code which also dislikes me at the moment when trying to import the above mentioned modules.
Is there a way that I can use the modules that are now stored in 3 different locations to centralise them in 1 location and being able to use them with powershell 6/7



Hi Acer,

Can you please post the error that you are seeing when you are trying to install those modules?

Because AzureAD and MSOnline modules are pretty much compatible with PowerShell 6/7, and they are also available in Azure Cloud Shell.

Thank you,


Install the modules in Powershell 5.
You can’t realy upgrade from WindowsPowershell 5 to Powershell 7. But you can install both.
WindowsPowershell 5 and Powershell 7 should be installed at the same time.

To use Powershell 5 installed modules in Powershell 7 use:

Import-Module MSOnline -UseWindowsPowerShell

It makes an PSSession to PS5 to use the WPS5 modules in PS7.

thanks Chris, that did the trick