'Connect-MsolService' Is Not Recognized As The Name Of A Cmdlet


Answer :

I had to do this in that order:



Install-Module MSOnline
Install-Module AzureAD
Import-Module AzureAD


All links to the Azure Active Directory Connection page now seem to be invalid.



I had an older version of Azure AD installed too, this is what worked for me.
Install this.



Run these in an elevated PS session:



uninstall-module AzureAD  # this may or may not be needed
install-module AzureAD
install-module AzureADPreview
install-module MSOnline


I was then able to log in and run what I needed.



This issue can occur if the Azure Active Directory Module for Windows PowerShell isn't loaded correctly.



To resolve this issue, follow these steps.

1.Install the Azure Active Directory Module for Windows PowerShell on the computer (if it isn't already installed). To install the Azure Active Directory Module for Windows PowerShell, go to the following Microsoft website:

Manage Azure AD using Windows PowerShell



2.If the MSOnline module isn't present, use Windows PowerShell to import the MSOnline module.



Import-Module MSOnline 


After it complete, we can use this command to check it.



PS C:\Users> Get-Module -ListAvailable -Name MSOnline*


Directory: C:\windows\system32\WindowsPowerShell\v1.0\Modules


ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 1.1.166.0 MSOnline {Get-MsolDevice, Remove-MsolDevice, Enable-MsolDevice, Disable-MsolDevice...}
Manifest 1.1.166.0 MSOnlineExtended {Get-MsolDevice, Remove-MsolDevice, Enable-MsolDevice, Disable-MsolDevice...}


More information about this issue, please refer to it.






Update:



We should import azure AD powershell to VS 2015, we can add tool and select Azure AD powershell.



enter image description here



Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable