I want to run an Azure PowerShell Script in Core-edition, using the PowerShell Edition feature, but I get the following messages in the log:
Name Value
PSVersion 7.0.3
PSEdition Core
GitCommitId 7.0.3
OS Microsoft Windows 6.3.9600
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0.}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
PowerShell Environment Information:
OperatingSystem: Microsoft Windows NT 6.3.9600.0
OsBitVersion: x64
Is64BitProcess: True
ProcessorCount: 4
HostProcess: pwsh (1728)
TotalPhysicalMemory: 12582452 KB
AvailablePhysicalMemory: 5295536 KB
CloseError: Could not load type ‘System.Security.Cryptography.SHA256Cng’ from assembly ‘System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’.
At D:\Octopus\Work\20201020095101-397065-26513\Octopus.AzureContext.ps1:90 char:13
-
Login-AzureRmAccount -Credential $creds -TenantId $Octopu .
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
at , D:\Octopus\Work\20201020095101-397065-26513\Octopus.AzureContext.ps1: line 90
at Execute-WithRetry, D:\Octopus\Work\20201020095101-397065-26513\Octopus.AzureContext.ps1: line 49
at , D:\Octopus\Work\20201020095101-397065-26513\Octopus.AzureContext.ps1: line 62
at , D:\Octopus\Work\20201020095101-397065-26513\Bootstrap.Octopus.AzureContext.ps1: line 2029
at , : line 1
at , : line 1
Seems Login-AzureRmAccount is not working in PS 7… it seems you need to do first ‘Import-Module -Name AzureAD -UseWindowsPowerShell’, to be able to use that cmdlet in PS 7.
However I can’t seems to find a way to force that import-command before the Login-AzureRmAccount-command is done by the built-in Octopus script.
Any help or any idea’s?
Br, J