Powershell: Install-Module AzureAD on linux failes

Created on 30 Oct 2017  Â·  27Comments  Â·  Source: PowerShell/PowerShell

Steps to reproduce

PS> Install-Module AzureAD 

Expected behavior

Installation of AzureAD module

Actual behavior

PS> Install-Module 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 /opt/microsoft/powershell/6.0.0-beta.9/Modules/PowerShellGet/1.5.0.0/PSModule.psm1:1877 char:21    + ...          $null = PackageManagement\Install-Package @PSBoundParameters                           
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Microsoft.Power....InstallPackage:InstallPackage) [Inst 
   all-Package], Exception
    + FullyQualifiedErrorId : System.DllNotFoundException,Microsoft.PowerShell.Commands.TestModuleMa 
   nifestCommand,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Environment data

# pwsh 
PowerShell v6.0.0-beta.9
Copyright (C) Microsoft Corporation. All rights reserved.
> $PSVersionTable

Name                           Value                                                                                
----                           -----                                                                                
PSVersion                      6.0.0-beta.9                                                                         
PSEdition                      Core                                                                                 
GitCommitId                    v6.0.0-beta.9                                                                        
OS                             Linux 4.10.0-37-generic #41~16.04.1-Ubuntu SMP Fri Oct 6 22:42:59 UTC 2017           
Platform                       Unix                                                                                 
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                              
PSRemotingProtocolVersion      2.3                                                                                  
SerializationVersion           1.1.0.1                                                                              
WSManStackVersion              3.0  
Resolution-External

Most helpful comment

I am experiencing the same issue.

All 27 comments

The AzureAD module is not compatible with non-windows platforms. I believe it is still using ADAL which has WinForms dependencies. According to the project page (https://docs.microsoft.com/en-us/powershell/module/Azuread/?view=azureadps-2.0) these are the supported OSes:

Windows 10 Windows 8.1 Pro Windows 8.1 Enterprise Windows 7 SP1 Windows Server 2016 TP5 Windows Server 2012 R2 Windows Server 2008 R2 SP1

You may want to request Linux compatibility on the Azure AD Uservoice: https://feedback.azure.com/forums/169401-azure-active-directory

Cross-platform AzureAD module is work in progress. You can use the preview version (AzureAD.Standard.Preview) in Azure Cloud Shell.

Do we have any AzureAD standard preview version to test on PowerShell Core 6.1?

Can PowerShell Core execute these AzureAD standard module, if PowerShell Core is hosted on Windows environment?

Hi, it appears this is still not possible on pwsh?

PS /home/> Install-module AzureADPreview

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"): A
PackageManagement\Install-Package : Unable to load shared library 'api-ms-win-core-sysinfo-l1-1-0.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libapi-ms-win-core-sysinfo-l1-1-0.dll: cannot open shared object file: No such file or directory                                                                                                                                                                                         At /opt/microsoft/powershell/6/Modules/PowerShellGet/PSModule.psm1:9491 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



Shoudn't this issue be still open since it is not fixed???

This module is not owned or managed by anyone in this repo, and development of it is not related to this repo. As mentioned, the preview version of the module can be used in the meantime if you so wish, but apart from that we can only wait for the Azure team to release a more complete version of the module. :slightly_smiling_face:

I also have this error:

PS /home/khine> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.2.3
PSEdition                      Core
GitCommitId                    6.2.3
OS                             Linux 5.0.0-29-generic #31-Ubuntu SMP Thu Sep 12 13:05:32 UTC 2019
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

PS /home/khine> Install-module AzureADPreview

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 shared library 'api-ms-win-core-sysinfo-l1-1-0.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libapi-ms-win-core-sysinfo-l1-1-0.dll: cannot open shared object file: No such file or directory                                                                       At /snap/powershell/39/opt/powershell/Modules/PowerShellGet/PSModule.psm1:9508 char:21                                                                                                               + ...          $null = PackageManagement\Install-Package @PSBoundParameters                                                                                                                          +                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                          
+ CategoryInfo          : NotSpecified: (Microsoft.PowerShel\u2026lets.InstallPackage:InstallPackage) [Install-Package], Exception
+ FullyQualifiedErrorId : System.DllNotFoundException,Microsoft.PowerShell.Commands.TestModuleManifestCommand,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

any news on this?

This is a really poor follow up by Microsoft.

Yeah this is also broken on macOS... same error as indicated above on Linux.

Same issue here

PS /Users/stuartlupton> $PSVersionTable

Name Value
---- -----
PSVersion 6.2.3
PSEdition Core
GitCommitId 6.2.3
OS Darwin 19.0.0 Darwin Kernel Version 19.0.0: Tue Sep 17 01:59:51 PDT 2019; root:xnu-6153.11.24~17/RELEASE_X86_64
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

PS /Users/stuartlupton> 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"): A
PackageManagement\Install-Package : Unable to load shared library 'api-ms-win-core-sysinfo-l1-1-0.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(libapi-ms-win-core-sysinfo-l1-1-0.dll, 1): image not found At /usr/local/microsoft/powershell/6/Modules/PowerShellGet/PSModule.psm1:9508 char:21 + ... $null = PackageManagement\Install-Package @PSBoundParameters

  • ~~~~~~~~~~~~
  • CategoryInfo : NotSpecified: (Microsoft.PowerShel\u2026lets.InstallPackage:InstallPackage) [Install-Package], Exception
  • FullyQualifiedErrorId : System.DllNotFoundException,Microsoft.PowerShell.Commands.TestModuleManifestCommand,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

@dbsysteluk-stuartlupton I logged this issue #10326 a few days back on the Azure PowerShell repository

Is there a fix for this? I also have this problem:

Install-Module -Name AzureADPreview

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"):A
PackageManagement\Install-Package : Unable to load shared library 'api-ms-win-core-sysinfo-l1-1-0.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libapi-ms-win-core-sysinfo-l1-1-0.dll: cannot open shared object file: No such file or directory
At /snap/powershell/39/opt/powershell/Modules/PowerShellGet/PSModule.psm1:9508 char:21

  • ... $null = PackageManagement\Install-Package @PSBoundParameters
  • ~~~~~~~~~~~~
  • CategoryInfo : NotSpecified: (Microsoft.PowerShel\u2026lets.InstallPackage:InstallPackage) [Install-Package], Exception
  • FullyQualifiedErrorId : System.DllNotFoundException,Microsoft.PowerShell.Commands.TestModuleManifestCommand,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Any news here? I'm running it on my Mac and still getting the error below.

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.

I know the repo has 2.1k issues that are open right now, but I'm also experiencing the issue and would be grateful for a resolution.

Ubuntu 19.10
PowerShell 7.0.0-preview.5

Install-Module 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"): a
Install-Package: /snap/powershell-preview/51/opt/powershell/Modules/PowerShellGet/PSModule.psm1                                                                                          Line |   

Line 9683 $installedPackages = PackageManagement\Install-Package @PSBoundParameters                                                                                                 
Unable to load shared library 'api-ms-win-core-sysinfo-l1-1-0.dll' or one of its dependencies. In order to help diagnose loading problems,              
consider setting the LD_DEBUG environment variable: libapi-ms-win-core-sysinfo-l1-1-0.dll: cannot open shared object file: No such file or directory

I am experiencing the same issue.

For anyone having issues with the Preview module, you can grab it from the poshtest gallery:

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

 Install-Module -Name AzureAD.Standard.Preview

I am also facing the same issue. Please resolve.

same issue (#11229)

same issue

Same issue, but in Cloud Shell. Is there a way to install the AzureAD Preview Module in Cloud Shell?

AzureAD Preview module is already installed in Cloud Shell.

AzureAD Preview module is already installed in Cloud Shell.

I'm unable to use commands such as Get-AzureADPolicy in Cloud Shell. It can't find the cmdlets

The only policy-related cmdlets in AzureAD.Standard.Preview module are:

PS Azure:\> Get-Command -Name *policy* -Module AzureAD.Standard.Preview

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          Add-AzureADMSLifecyclePolicyGroup                  0.0.0.10   AzureAD.Standard.Preview
Cmdlet          Get-AzureADMSGroupLifecyclePolicy                  0.0.0.10   AzureAD.Standard.Preview
Cmdlet          Get-AzureADMSLifecyclePolicyGroup                  0.0.0.10   AzureAD.Standard.Preview
Cmdlet          New-AzureADMSGroupLifecyclePolicy                  0.0.0.10   AzureAD.Standard.Preview
Cmdlet          Remove-AzureADMSGroupLifecyclePolicy               0.0.0.10   AzureAD.Standard.Preview
Cmdlet          Remove-AzureADMSLifecyclePolicyGroup               0.0.0.10   AzureAD.Standard.Preview
Cmdlet          Set-AzureADMSGroupLifecyclePolicy                  0.0.0.10   AzureAD.Standard.Preview

https://docs.microsoft.com/en-us/powershell/module/azuread/get-azureadpolicy?view=azureadps-2.0-preview

Here is the specific module that i'm looking to use in Cloud Shell

The Get-AzureADPolicy cmdlet gets a policy in Azure Active Directory (AD).

On linux (centos7) installed powershell core and the AzureAD.Standard.Preview module (with some help from https://blogs.endjin.com/2019/05/how-to-use-the-azuread-module-in-powershell-core/).

Register-PackageSource -Name PoshTestGallery -Location https://www.poshtestgallery.com/api/v2/ -ProviderName PowerShellGet

Install-Module -Name AzureAD.Standard.Preview -RequiredVersion 0.0.0.10

Import-Module -Name /root/.local/share/powershell/Modules/AzureAD.Standard.Preview/0.0.0.10/AzureAD.Standard.Preview.psm1

This is working however as mentioned by others it is missing some cmdlets.

PS /home/*****> Get-AzureADMS*
Get-AzureADMSDeletedDirectoryObject  
Get-AzureADMSGroup                  
Get-AzureADMSIdentityProvider
Get-AzureADMSDeletedGroup           
Get-AzureADMSGroupLifecyclePolicy    
Get-AzureADMSLifecyclePolicyGroup

We require the Get-AzureADMSTrustFrameworkPolicy which is not present

Was this page helpful?
0 / 5 - 0 ratings