如何在mac上使用poweshell的azures模块



我需要从Mac Big Sur上的PowerShell 7或7.1中的AzureAD模块访问一些cmdlet。

  1. 已安装Powershell和自制啤酒
  2. 使用了来自Microsoft的powershell的docker映像

当我导入模块AzureAD时,我得到以下错误

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.

经过一些研究,MacOS目前似乎不支持上述两种情况。

其他人是怎么做到的?

thx,Joe

更新:显然是以下作品。

>Register-PackageSource -Trusted -ProviderName 'PowerShellGet' -Name 'Posh Test Gallery' -Location https://www.poshtestgallery.com/api/v2/ 
Register-PackageSource: Package Source 'Posh Test Gallery' exists.

>Install-Module AzureAD.Standard.Preview
>Import-Module AzureAD.Standard.Preview
WARNING: /Users/joe/.local/share/powershell/Modules/AzureAD.Standard.Preview/0.1.599.7
WARNING: AzureAD.Standard.Preview
WARNING: /Users/joe/.local/share/powershell/Modules/AzureAD.Standard.Preview/0.1.599.7/net471
WARNING: Loading module in coreclr folder: 'netstandard2.0' ...
>Connect-AzureAD
WARNING: To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code sx22443 to authenticate.

此处

不完美,但部分支持

>Register-PackageSource -Trusted -ProviderName 'PowerShellGet' -Name 'Posh Test Gallery' -Location https://www.poshtestgallery.com/api/v2/ 
Register-PackageSource: Package Source 'Posh Test Gallery' exists.

>Install-Module AzureAD.Standard.Preview
>Import-Module AzureAD.Standard.Preview
WARNING: /Users/joe/.local/share/powershell/Modules/AzureAD.Standard.Preview/0.1.599.7
WARNING: AzureAD.Standard.Preview
WARNING: /Users/joe/.local/share/powershell/Modules/AzureAD.Standard.Preview/0.1.599.7/net471
WARNING: Loading module in coreclr folder: 'netstandard2.0' ...
>Connect-AzureAD
WARNING: To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code sx22443 to authenticate.

最新更新