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