Is it possible the Dockerfile is building a container that doesn't have the proper certificates to authenticate the signed modules?
Unable to install powershell module due to the authenticode signature of the file 'MicrosoftTeams.psd1' is not valid
I'm having problems installing the Microsoft Teams module into a PowerShell container. From this docker hub site:
https://hub.docker.com/\_/microsoft-powershell
I'm using this Dockerfile:
https://github.com/PowerShell/PowerShell-Docker/blob/master/release/7-2/nanoserver1809/docker/Dockerfile
I built the cointainer with this command:
docker build . -f .\Docker\Docker.dockerfile -t provisioning-container:lts-7.2-nanoserver-1809
After building, the container launches and the PowerShell commandlets work. My ultimate goal is to launch the container with multiple modules installed, but I can't even get one to install manually, so I'm asking for help.
I've tried many iterations of this command, but none of them actually install anything:
(I've tried with and without all of the switches below. When I remove -force and include -SkipPublisherCheck it acts like it installs, but nothing actually happens)
PS C:\>
PS C:\> Install-Module -Name MicrosoftTeams -AllowClobber -Force -SkipPublisherCheck
Install-Package: C:\program files\powershell\Modules\PowerShellGet\PSModule.psm1:9685
Line |
9685 | … talledPackages = PackageManagement\Install-Package @PSBoundParameters
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| The module 'MicrosoftTeams' cannot be installed or updated because the authenticode signature of the file'MicrosoftTeams.psd1' is not valid.
I saw some previous posts, but they don't fix my issue. In those posts, the experts wanted this info:
Get-Module -ListAvailable PowerShellGet
PS C:\>
PS C:\> Get-Module -ListAvailable PowerShellGetDirectory: C:\program files\powershell\Modules
ModuleType Version PreRelease Name PSEdition ExportedCommands
Script 2.2.3 PowerShellGet Desk {Find-Command, Find-DSCResource, Find-Module, Find-> > > RoleCapability…}
PS C:\>
PS C:\> $psversiontableName Value
PSVersion 7.0.0
PSEdition Core
GitCommitId 7.0.0
OS Microsoft Windows 10.0.17763
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0PS C:\>
PS C:\> get-executionpolicy -listScope ExecutionPolicy ----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Undefined
LocalMachine RemoteSignedPS C:\>
Microsoft Teams Microsoft Teams for business Other
2 answers
Sort by: Most helpful
-
-
Nick Barnett 1 Reputation point
2022-12-22T17:07:17.587+00:00 Apparently it's impossible to install any modules into nano server. It's been this way for years and I doubt they have it prioritized to fix.
https://github.com/PowerShell/PowerShell-Docker/wiki/Known-Issues
I went with this Dockerfile and everything just worked without issue.
Adding this immediately above "CMD ["pwsh.exe"] successfully built my image:
# install the Teams Module
RUN pwsh.exe -command "Install-Module -Name MicrosoftTeams -Force"
RUN pwsh.exe -command "Install-Module -Name AzureAD -Force"