System.Security.Cryptography.SHA256Cng fails to load
See original GitHub issueSteps to reproduce
(Note: exact same results with up-to-date pwsh-preview.)
09:52:41 evil@P950ER ~/Downloads» pwsh
PowerShell 6.2.2
Copyright (c) Microsoft Corporation. All rights reserved.
https://aka.ms/pscore6-docs
Type 'help' to get help.
PS /data/Downloads> install-module Microsoft.Graph.Intune
PS /data/Downloads> Import-Module Microsoft.Graph.Intune
PS /data/Downloads> Connect-MSGraph
Expected behavior
I expected to be prompted for credentials and connect to the graph API.
Actual behavior
Connect-MSGraph : Could not load type 'System.Security.Cryptography.SHA256Cng' from assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
At line:1 char:1
+ Connect-MSGraph
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Connect-MSGraph], TypeLoadException
+ FullyQualifiedErrorId : System.TypeLoadException,Microsoft.Intune.PowerShellGraphSDK.PowerShellCmdlets.Connect
Environment data
---- -----
PSVersion 6.2.2
PSEdition Core
GitCommitId 6.2.2
OS Linux 5.2.0-8-generic #9-Ubuntu SMP Mon Jul 8 13:07:27 UTC 2019
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
This was tested with core 6 as well as the current pwsh-preview (PowerShell 7) github build from source (as of 8/6/2019) as well as current pwsh & pwsh-preview snaps on Ubuntu 18.04 and Ubuntu 19.10 (Eoan Ermine). See https://github.com/PowerShell/PowerShell/issues/10291.
I also reported this bug in the PowerShellModuleCoverage repo, https://github.com/PowerShell/PowerShellModuleCoverage/issues/9#event-2541388639, but they closed it and suggested I open it here. I’m not sure if it’s because SHA256Cng is deprecated or if there’s other reasoning.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Connect-AzureAD Could not load type 'System.Security. ...
Connect-AzureAD: One or more errors occurred. (Could not load type 'System.Security.Cryptography.SHA256Cng' from assembly 'System.
Read more >powershell login error - Microsoft Q&A
Connect-AzureAD: One or more errors occurred. (Could not load type 'System.Security.Cryptography.SHA256Cng' from assembly 'System.
Read more >Could not load type 'System.Security.Cryptography. ...
Trying to use azure functions to run an Exchange update powershell script. When using this command: Connect-ExchangeOnline -AppId $appId ...
Read more >Connect-AzureAd fails in PowerShell version 7 with
Connect-AzureAD: One or more errors occurred. (Could not load type 'System.Security.Cryptography.SHA256Cng' from assembly 'System.
Read more >PowerShell 7.2.7 and Could not load type 'System.Security ...
7 and Could not load type 'System. Security. Cryptography. SHA256Cng' – Set-AzWebApp -name "Anything Microsoft and other stuff on the side"
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Any updates from the team on this issue? See: https://github.com/dotnet/runtime/issues/25044#issuecomment-520203003
It installs always the “desk” version of the module. (Same problem as installing it into Azure Cloud Shell)