术语 'Set-AzureADGroup' 未被识别为 cmdlet 的名称

The term 'Set-AzureADGroup' is not recognized as a name of a cmdlet

我正在尝试使用 Mac 上 AzureAD 的 powershell 命令 Set-AzureADGroup。但它一直失败:

Set-AzureADGroup: The term 'Set-AzureADGroup' 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.

以下是我采取的步骤:

Import-Module AzureAD -UseWindowsPowerShell

Set-AzureADGroup

我正在使用 powershell 7.1.5 并且我的 psmodulepath 似乎是正确的:

PS /Users/**name> echo $env:PSModulePath /Users/**name/.local/share/powershell/Modules:/usr/local/share/powershell/Modules:/usr/local/microsoft/powershell/7/Modules

如果我使用:

>Import-Module AzureAD
Import-Module: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.

docs for the AzureAD module表示它只运行在Windows.

不幸的是,当您尝试在不受支持的平台(例如您的 macOS)上导入模块时收到的错误消息并未明确这样说,它可以从其措辞中推断System.Windows.Forms namespace 中的类型仅在 Windows 上可用。