aws / aws-tools-for-powershell

The AWS Tools for PowerShell lets developers and administrators manage their AWS services from the PowerShell scripting environment.
Apache License 2.0
235 stars 78 forks source link

Install-Module Fails on mcr.microsoft.com/powershell:6.2.3-nanoserver-1803 #130

Closed bo67192 closed 3 years ago

bo67192 commented 4 years ago

I'm trying to run Install-Module AWS.Tools.Installer -force -confirm:$false inside of a container from mcr.microsoft.com/powershell:6.2.3-nanoserver-1803, but I get an error.

Expected Behavior

I expect to be able to run

docker run -it mcr.microsoft.com/powershell:6.2.3-nanoserver-1803

And then this inside of the container

Install-Module AWS.Tools.Installer -force -confirm:$false;

And have the AWS tools installer available

Current Behavior

Instead of getting the install I get this

PackageManagement\Install-Package : The module 'AWS.Tools.Installer' cannot be installed or updated because the authenticode signature of the file 'AWS.Tools.Installer.psd1' is not valid.
At C:\program files\powershell\Modules\PowerShellGet\PSModule.psm1:9508 char:21
+ ...          $null = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (Microsoft.PowerShel\u2026lets.InstallPackage:InstallPackage) [Install-Package], Exception
+ FullyQualifiedErrorId : InvalidAuthenticodeSignature,ValidateAndGet-AuthenticodeSignature,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Steps to Reproduce (for bugs)

Run

docker run -it mcr.microsoft.com/powershell:6.2.3-nanoserver-1803

to get a running powershell container, then run this inside of the container

Install-Module AWS.Tools.Installer -force -confirm:$false;

I'm not running any other commands inside of the container.

Context

We're trying to use the AWS Powershell tools modularized version

Your Environment

I'm running windows 10 version 1803 build 17134.1246

PS > docker --version
Docker version 19.03.5, build 633a0ea

I appreciate any help

matteo-prosperi commented 4 years ago

Hello, I will try to test this myself and see if I can get more insight.

This is very unexpected, you are getting an error running Install-Module Questions:

Possible workarounds:

bo67192 commented 4 years ago

Hi @matteo-prosperi ,

Here's my $psversiontable

PS C:\> $psversiontable

Name                           Value
----                           -----
PSVersion                      6.2.3
PSEdition                      Core
GitCommitId                    6.2.3
OS                             Microsoft Windows 10.0.17134
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0?}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

It looks like I can't install AWS.Tools.EC2 either:

PS C:\> install-module AWS.Tools.EC2
WARNING: Win32Helpers: Cannot add type. Compilation errors occurred.
WARNING: Could not find a part of the path 'C:\Users\ContainerAdministrator\AppData\Local\Microsoft\Windows\PowerShell\PowerShellGet\PSRepositories.xml'.

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 : The module 'AWS.Tools.Common' cannot be installed or updated because the authenticode signature of the file 'AWS.Tools.Common.psd1' is not valid.
At C:\program files\powershell\Modules\PowerShellGet\PSModule.psm1:9508 char:21
+ ...          $null = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (Microsoft.PowerShel\u2026lets.InstallPackage:InstallPackage) [Install-Package], Exception
+ FullyQualifiedErrorId : InvalidAuthenticodeSignature,ValidateAndGet-AuthenticodeSignature,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

but it looks like I can't install Pester either

PS C:\> install-module Pester

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 : The module 'Pester' cannot be installed or updated because the authenticode signature of the file 'Pester.psd1' is not valid.
At C:\program files\powershell\Modules\PowerShellGet\PSModule.psm1:9508 char:21
+ ...          $null = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (Microsoft.PowerShel\u2026lets.InstallPackage:InstallPackage) [Install-Package], Exception
+ FullyQualifiedErrorId : InvalidAuthenticodeSignature,ValidateAndGet-AuthenticodeSignature,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

I'm confused by this error

WARNING: Win32Helpers: Cannot add type. Compilation errors occurred.

Does that mean there's something wrong with my container, and it's not an AWS module problem?

matteo-prosperi commented 4 years ago

Hi, If you are not able to Install-Module anything, then it is likely an issue with your container. I would suggest trying on a different container than mcr.microsoft.com/powershell:6.2.3-nanoserver-1803 and see if you have better luck.

hanischandrew commented 4 years ago

Not that it's recommended, but you could add '-SkipPublisherCheck' to the Install-Module command.

ashishdhingra commented 3 years ago

Hi @bo67192,

Please confirm if this is no longer an issue or if you are able to test it on a different container as suggested by @matteo-prosperi.

Thanks, Ashish

github-actions[bot] commented 3 years ago

This issue has not recieved a response in 2 weeks. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.