'Cannot run Connect-AzureAD on Mac powershell

I ran the following commands as per some other posts:

Install-Module -Name AzureAD  
Import-Module AzureAD -UseWindowsPowerShell 

When I try to execute Connect-AzureAD, the standard error comes up:

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

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

Any ideas on how to get Connect-AzureAD to work on powershell for Mac?



Solution 1:[1]

"AzureAD" and "AzureADPReview" modules are only supported with Windows PowerShell 5.1 (https://docs.microsoft.com/en-us/powershell/azure/active-directory/install-adv2?view=azureadps-2.0).

if you want to access Azure AD using PowerShell 7 (e.g. from MacOS), you need to use different modules:

  • "Az" modules
  • "Microsoft.Graph.*" modules (e.g. "Microsoft.Graph.Users", "Microsoft.Graph.Groups")

ref:

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MikeSh