AzureAD module installed on Mac but connect-AzureAD is not recognized

I’m using Mac OS Catalina 10.15.7
I’ve installed Powershell using brew.
$PSVersionTable returns:
Name Value

PSVersion 7.1.3
PSEdition Core
GitCommitId 7.1.3
OS Darwin 19.6.0 Darwin Kernel Version 19.6.0: Tue Jan 12 22:13:05 PST 2021; root:xnu-6153…
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
WSManStackVersion 3.0

I installed the az and azuread modules using
install-module az -force
install-module azuread -forace

Both modules installed

get-installedmodule returns a whole list of modules which include az and azuread
5.7.0 Az PSGallery Microsoft Azure PowerShell - Cmdlets to … AzureAD PSGallery Azure Active Directory V2 General Availa…

My az module seems to work
I can issue connect-azaccount and get into Azure

My azuread module does not work at all
PS /Users/jsebast/NWM/Powershell> connect-azuread
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.

On a Mac, I believe the modules are installed in $HOME/.local/share/powershell/Modules

Looking in that directory, I see both the az and AzureAD modules along with lots of others:
drwxr-xr-x 6 jsebast 1049671531 192 Mar 23 14:40 Az
drwxr-xr-x 4 jsebast 1049671531 128 Mar 23 14:43 AzureAD

There is a boatload of bad or outdated info on the web.

Does anyone have ideas about AzureAD module and Powershell on a Mac?

Try importing the module first:

Import-Module AzureAD

On Windows, Powershell will search and automatically import the module if the path is in one of the default paths, but not sure on Mac:

PS C:\Users\rasim\Desktop> $env:PSModulePath

C:\Users\rasim\Documents\PowerShell\Modules;C:\Program Files\PowerShell\Modules;c:\program files\powershell\7\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules;c:\Users\rasim\.vscode\extensions\ms-vscode.powershell-2021.2.2\modules

Unfortunately, that doesn’t work.

PS /Users/jsebast> import-module AzureAD
Import-Module: Could not load file or assembly ‘System.Windows.Forms, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089’. The system cannot find the file specified.

PS /Users/jsebast>

I have discovered that there are many Azure Active Directory functions within the az module. I hadn’t noticed this earlier. I’ll try and use those functions to do what I need to do.

otherwise you can also try the following if you stil want AzureAD commands

Register-PackageSource -Trusted -ProviderName 'PowerShellGet' -Name 'Posh Test Gallery' -Location'
Install-Module AzureAD.Standard.Preview
import-Module AzureAD.Standard.Preview

I’m having the same issue on a mac. I’ve got powershell 7.1.5 installed on my mac. I’ve got AzureAD, AzureADPreview, and the AZ modules installed. I’m able to Connect-AZAccount and log into my tennant. Thats as far as I can get. Connect-AzureAD, Connect-AzureADPreview, dont connect to Azure AD. I’ve searched for documentation about managing my Azure AD environment once connected to Azure in PS but nothing seems to help.

My question here is once connect to Azure in PS 7.1.5 on Mac how do I manage Azure AD?

Thanks in advance,

Its because AzureAD module never loads. Issue with Arch - AMD64

VERBOSE: Loading module from path ‘/Users//.local/share/powershell/Modules/AzureADPreview/’.
Import-Module: The current processor architecture is: MSIL. The module ‘/Users//.local/share/powershell/Modules/AzureADPreview/
AzureADPreview.psd1’ requires the following architecture: Amd64.

I havent found a solution for this yet.

Hi jesc516, welcome to the forum :wave:

The AzureAD module won’t be supported on PowerShell Core. Try using the Microsoft Graph SDK. It is and will be supported cross-platform.

The legacy Graph APIs are being retired on 30th June 2022 and while Microsoft seem determined to keep exactly what’s going to happen to the AzureAD and MSOL modules a secret, some functionality (licensing) will definitely stop working when the APIs are retired in favour of Microsoft Graph. The broad consensus is that everyone should be working to upgrade their scripts and modules to use the Microsoft Graph SDK instead of the AzureAD and MSOL modules.