Connect-AzureAd is not recognized

Viewed 8537

I am trying to make this command working on my MAC OS and even installing all modules I have found in other blogs, like AzureAD, AzureADPreview.¨. I still get the same message. Can someone please give me some clue about fixing?

Connect-AzureAD: The term 'Connect-AzureAD' is not recognized as the name of a cmdlet, function, script file, or operable program.

                                                         
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Name                           Value
----                           -----
PSVersion                      7.0.3
PSEdition                      Core
GitCommitId                    7.0.3
OS                             Darwin 19.6.0 Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
1 Answers

The fact you're getting an error message suggesting the cmdlet isn't recognized points to the fact you haven't installed or imported the correct module. Important to note regarding AzureAD module is generally not used, you should generally be aiming to use the AZ module where possible.

If you're specifically looking to use AzureAD then use can use the following

Register-PackageSource -Trusted -ProviderName 'PowerShellGet' -Name 'Posh Test Gallery' -Location https://www.poshtestgallery.com/api/v2/
Install-Module AzureAD.Standard.Preview
import-Module AzureAD.Standard.Preview

I would suggest you use the AZ Module using:

Install-Module az
Import-Module az

for the cmdlet connect-azureAD you can use connect-azaccount

Because you're using a Mac you won't be met with windows prompt to login, you'll be given a link you'll need to manually use to log into for auth.

Related