"Install-Module -name AzureAD" fails with error on PS6 with MacOSX

2

I was able to install Powershell Core on MacOSX and now I'm trying to administer an Azure AD instance from the same.

When I install the AzureAD module, I get the following error

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

I looked around for ways to get api-ms-win-core-sysinfo installed on Mac, but being it's a different OS, I didn't see any straightforward resolutions.

macos
azure
azure-active-directory
azure-powershell
powershell-core
asked on Stack Overflow Jul 28, 2018 by Ran Dom • edited Oct 4, 2019 by 4c74356b41

4 Answers

5

This module is not yet ported to dotnet core, so you cant use it on Linux\Mac.

You can take a look here:

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

also, you can use this search to confirm my statement:

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

answered on Stack Overflow Jul 28, 2018 by 4c74356b41 • edited Jul 28, 2018 by (unknown user)
0

As @4c74356b41 rightly says, the Azure AD module is not ported to PowerShell core yet.

Besides installing a VM with windows, and depending exactly what you wish to do, you could try the Azure CLI for OS X

If a browser experience is okay for you, the Azure Cloud Shell also offers CLI and even some Powershell commands (though this also runs on Core in the background):

0

If you look at the error message it is clear, that the error is not about the AzureAD module not being available on your platform, but more about the "PackageManagement"-Package not being supported. So you can try downloading the module directly from powershellgallery and unzipping it into your module path.

answered on Stack Overflow Aug 20, 2018 by K. Frank
0

I've hit the same problem - it's frustrating that the AzureAD module isn't open-sourced on GitHub. While the Az module is, it lacks most of the functionality of the AzureAd module.

One option is to "copy" the version of AzureAD from cloud shell, as outlined here: https://www.michev.info/Blog/Post/2339/azure-ad-powershell-module-with-support-for-powershell-core

Another option is to write your own Powershell core module that calls the Graph REST APIs directly.

answered on Stack Overflow Jun 7, 2019 by crimbo

User contributions licensed under CC BY-SA 3.0