2

我能够在 MacOSX 上安装 Powershell Core,现在我正尝试从该实例管理 Azure AD 实例。

安装 AzureAD 模块时,出现以下错误

PS /Users/c> Install-Module -name AzureAD                                  

Untrusted repository
You are installing the modules from an untrusted repository. If you trust this 
repository, change its InstallationPolicy value by running the Set-PSRepository
 cmdlet. Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help 
(default is "N"):y
PackageManagement\Install-Package : Unable to load DLL 'api-ms-win-core-sysinfo-l1-1-0.dll': The specified module or one of its dependencies could not be found. (Exception from HRESULT: 0x8007007E)                                           At /usr/local/microsoft/powershell/6.0.2/Modules/PowerShellGet/1.6.0/PSModule.psm1:2057 char:21                                                                 + ...          $null = PackageManagement\Install-Package @PSBoundParameters     
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
+ FullyQualifiedErrorId : System.DllNotFoundException,Microsoft.PowerShell.Commands.TestModuleManifestCommand,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

我四处寻找在 Mac 上安装 api-ms-win-core-sysinfo 的方法,但由于它是不同的操作系统,我没有看到任何直接的解决方案。

4

4 回答 4

5

这个模块还没有移植到 dotnet core,所以你不能在 Linux\Mac 上使用它。

你可以看看这里:

https://www.powershellgallery.com/packages/AzureAD/2.0.1.6

此外,您可以使用此搜索来确认我的声明:

https://www.powershellgallery.com/items?q=Tags%3A%22PSEdition_Core%22++azuread&x=0&y=0

于 2018-07-28T17:49:13.777 回答
0

如果您查看错误消息,很明显,该错误不是关于 AzureAD 模块在您的平台上不可用,而是更多关于“PackageManagement”-Package 不受支持。因此,您可以尝试直接从 powershellgallery 下载模块并将其解压缩到您的模块路径中。

于 2018-08-20T08:38:29.510 回答
0

正如@4c74356b41 所说,Azure AD 模块尚未移植到 PowerShell 核心。

除了安装带有 windows 的 VM 之外,根据您的具体需要,您还可以尝试使用适用于 OS X 的 Azure CLI

如果您的浏览器体验没问题,Azure Cloud Shell还提供 CLI 甚至一些 Powershell 命令(尽管它也在后台的 Core 上运行):

于 2018-07-30T08:32:44.690 回答
0

我遇到了同样的问题——令人沮丧的是 AzureAD 模块在 GitHub 上没有开源。虽然 Az 模块是,但它缺少 AzureAd 模块的大部分功能。

一种选择是从云外壳“复制”AzureAD 版本,如下所述: https ://www.michev.info/Blog/Post/2339/azure-ad-powershell-module-with-support-for-powershell -核

另一种选择是编写自己的 Powershell 核心模块,直接调用 Graph REST API。

于 2019-06-07T21:35:17.843 回答