Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.21k stars 3.82k forks source link

PS7 - az.storage load errors #12786

Closed peppekerstens closed 4 years ago

peppekerstens commented 4 years ago

Description

When importing az module version 4.50 & 4.6.0 within PS7, I receive load errors on az.storage.

Steps to reproduce

PS7 env

(clean PS session each time)

import-module az -RequiredVersion 3.8.0 #loads fine
import-module az -RequiredVersion 4.5.0
Import-Module: C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Storage\2.4.0\Az.Storage.psm1:113
Line |
 113 |  Import-Module (Join-Path -Path $PSScriptRoot -ChildPath Microsoft.Azu …
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Could not load file or assembly 'Azure.Core, Version=1.2.2.0, Culture=neutral,
     | PublicKeyToken=92742159e12e44c8'. The system cannot find the file specified.
import-module az -RequiredVersion 4.6.0
Import-Module: C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Storage\2.5.0\Az.Storage.psm1:113
Line |
 113 |  Import-Module (Join-Path -Path $PSScriptRoot -ChildPath Microsoft.Azu …
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Could not load file or assembly 'Azure.Core, Version=1.3.0.0, Culture=neutral,
     | PublicKeyToken=92742159e12e44c8'. The system cannot find the file specified.

PS5 env

(clean PS session each time)

import-module az -RequiredVersion 4.5.0 #loads fine
import-module az -RequiredVersion 3.8.0 #loads fine

Module versions

PS5 env

$psversiontable

Name                           Value
----                           -----
PSVersion                      5.1.19041.1
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

get-package az -AllVersions #get-module az <does not work>

Name                           Version          Source                           ProviderName
----                           -------          ------                           ------------
Az                             3.8.0            https://www.powershellgallery... PowerShellGet
Az                             4.5.0            https://www.powershellgallery... PowerShellGet

PS7 env

$psversiontable

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

Get-module az -ListAvailable

    Directory: C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     4.6.0                 Az                                  Core,Desk
Script     4.5.0                 Az                                  Core,Desk
Script     3.8.0                 Az                                  Core,Desk
Script     3.6.1                 Az                                  Core,Desk
Script     3.0.0                 Az                                  Core,Desk
Script     2.3.2                 Az                                  Core,Desk

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     4.5.0                 Az                                  Core,Desk
Script     3.8.0                 Az                                  Core,Desk

Debug output

This provides no extra info

Error output

resolve-azerror
WARNING: Breaking changes in the cmdlet 'Resolve-AzError' :
WARNING:  - The `Resolve-Error` alias will be removed in a future release.  Please change any scripts that use this alias to use `Resolve-AzError` instead.

WARNING: NOTE : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell.

   HistoryId: 1

Message        : Could not load file or assembly 'Azure.Core, Version=1.3.0.0, Culture=neutral,
                 PublicKeyToken=92742159e12e44c8'. The system cannot find the file specified.
StackTrace     :    at System.Reflection.RuntimeAssembly.GetExportedTypes(QCallAssembly assembly, ObjectHandleOnStack
                 retTypes)
                    at System.Reflection.RuntimeAssembly.GetExportedTypes()
                    at System.Management.Automation.Runspaces.PSSnapInHelpers.GetAssemblyTypes(Assembly assembly,
                 String name)
                    at
                 System.Management.Automation.Runspaces.PSSnapInHelpers.AnalyzeModuleAssemblyWithReflection(Assembly
                 assembly, String name, PSSnapInInfo psSnapInInfo, PSModuleInfo moduleInfo, String helpFile,
                 Dictionary`2& cmdlets, Dictionary`2& aliases, Dictionary`2& providers)
                    at System.Management.Automation.Runspaces.PSSnapInHelpers.AnalyzePSSnapInAssembly(Assembly
                 assembly, String name, PSSnapInInfo psSnapInInfo, PSModuleInfo moduleInfo, Dictionary`2& cmdlets,
                 Dictionary`2& aliases, Dictionary`2& providers, String& helpFile)
                    at System.Management.Automation.Runspaces.InitialSessionState.ImportCmdletsFromAssembly(Assembly
                 assembly, PSModuleInfo module)
                    at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadBinaryModule(PSModuleInfo parentModule,
                 Boolean trySnapInName, String moduleName, String fileName, Assembly assemblyToLoad, String
                 moduleBase, SessionState ss, ImportModuleOptions options, ManifestProcessingFlags
                 manifestProcessingFlags, String prefix, Boolean loadTypes, Boolean loadFormats, Boolean& found,
                 String shortModuleName, Boolean disableFormatUpdates)
                    at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModule(PSModuleInfo parentModule, String
                 fileName, String moduleBase, String prefix, SessionState ss, Object privateData, ImportModuleOptions&
                 options, ManifestProcessingFlags manifestProcessingFlags, Boolean& found, Boolean& moduleFileFound)
                    at
                 Microsoft.PowerShell.Commands.ImportModuleCommand.ImportModule_LocallyViaName(ImportModuleOptions
                 importModuleOptions, String name)
                    at Microsoft.PowerShell.Commands.ImportModuleCommand.ImportModule_LocallyViaName_WithTelemetry(Impo
                 rtModuleOptions importModuleOptions, String name)
                    at Microsoft.PowerShell.Commands.ImportModuleCommand.ProcessRecord()
                    at System.Management.Automation.CommandProcessor.ProcessRecord()
Exception      : System.IO.FileNotFoundException
InvocationInfo : {Import-Module}
Line           : Import-Module (Join-Path -Path $PSScriptRoot -ChildPath
                 Microsoft.Azure.PowerShell.Cmdlets.Storage.dll)

Position       : At C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Storage\2.5.0\Az.Storage.psm1:113 char:1
                 + Import-Module (Join-Path -Path $PSScriptRoot -ChildPath Microsoft.Azu …
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1

Message        : Cannot find a variable with the name 'RuntimeToDefaultVersion'.
StackTrace     :
Exception      : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line           :     if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position       : At C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Functions\1.0.1\custom\HelperFunctions.ps1
                 :88 char:15
                 + …   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) …
                 +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1

Message        : Cannot find a variable with the name 'RequiredStorageEndpoints'.
StackTrace     :
Exception      : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line           :     if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position       : At C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Functions\1.0.1\custom\HelperFunctions.ps1
                 :88 char:15
                 + …   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) …
                 +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1

Message        : Cannot find a variable with the name 'AllowedStorageTypes'.
StackTrace     :
Exception      : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line           :     if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position       : At C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Functions\1.0.1\custom\HelperFunctions.ps1
                 :88 char:15
                 + …   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) …
                 +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1

Message        : Cannot find a variable with the name 'DefaultFunctionsVersion'.
StackTrace     :
Exception      : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line           :     if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position       : At C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Functions\1.0.1\custom\HelperFunctions.ps1
                 :88 char:15
                 + …   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) …
                 +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1

Message        : Cannot find a variable with the name 'RuntimeToFormattedName'.
StackTrace     :
Exception      : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line           :     if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position       : At C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Functions\1.0.1\custom\HelperFunctions.ps1
                 :88 char:15
                 + …   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) …
                 +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1

Message        : Cannot find a variable with the name 'ReservedFunctionAppSettingNames'.
StackTrace     :
Exception      : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line           :     if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position       : At C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Functions\1.0.1\custom\HelperFunctions.ps1
                 :88 char:15
                 + …   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) …
                 +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1

Message        : Cannot find a variable with the name 'RuntimeToDefaultOSType'.
StackTrace     :
Exception      : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line           :     if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position       : At C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Functions\1.0.1\custom\HelperFunctions.ps1
                 :88 char:15
                 + …   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) …
                 +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1

Message        : Cannot find a variable with the name 'NodeDefaultVersion'.
StackTrace     :
Exception      : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line           :     if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position       : At C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Functions\1.0.1\custom\HelperFunctions.ps1
                 :88 char:15
                 + …   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) …
                 +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1

Message        : Cannot find a variable with the name 'DotNetRuntimeVersionToDotNetLinuxFxVersion'.
StackTrace     :
Exception      : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line           :     if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position       : At C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Functions\1.0.1\custom\HelperFunctions.ps1
                 :88 char:15
                 + …   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) …
                 +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1

Message        : Cannot find a variable with the name 'RuntimeVersions'.
StackTrace     :
Exception      : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line           :     if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position       : At C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Functions\1.0.1\custom\HelperFunctions.ps1
                 :88 char:15
                 + …   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) …
                 +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1

Message        : Cannot find a variable with the name 'RuntimeToDefaultVersion'.
StackTrace     :
Exception      : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line           :     if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position       : At C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Functions\1.0.1\custom\HelperFunctions.ps1
                 :88 char:15
                 + …   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) …
                 +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1

Message        : Cannot find a variable with the name 'RequiredStorageEndpoints'.
StackTrace     :
Exception      : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line           :     if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position       : At C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Functions\1.0.1\custom\HelperFunctions.ps1
                 :88 char:15
                 + …   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) …
                 +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1

Message        : Cannot find a variable with the name 'AllowedStorageTypes'.
StackTrace     :
Exception      : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line           :     if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position       : At C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Functions\1.0.1\custom\HelperFunctions.ps1
                 :88 char:15
                 + …   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) …
                 +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1

Message        : Cannot find a variable with the name 'DefaultFunctionsVersion'.
StackTrace     :
Exception      : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line           :     if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position       : At C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Functions\1.0.1\custom\HelperFunctions.ps1
                 :88 char:15
                 + …   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) …
                 +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1

Message        : Cannot find a variable with the name 'RuntimeToFormattedName'.
StackTrace     :
Exception      : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line           :     if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position       : At C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Functions\1.0.1\custom\HelperFunctions.ps1
                 :88 char:15
                 + …   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) …
                 +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1

Message        : Cannot find a variable with the name 'ReservedFunctionAppSettingNames'.
StackTrace     :
Exception      : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line           :     if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position       : At C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Functions\1.0.1\custom\HelperFunctions.ps1
                 :88 char:15
                 + …   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) …
                 +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1

Message        : Cannot find a variable with the name 'RuntimeToDefaultOSType'.
StackTrace     :
Exception      : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line           :     if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position       : At C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Functions\1.0.1\custom\HelperFunctions.ps1
                 :88 char:15
                 + …   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) …
                 +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1

Message        : Cannot find a variable with the name 'NodeDefaultVersion'.
StackTrace     :
Exception      : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line           :     if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position       : At C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Functions\1.0.1\custom\HelperFunctions.ps1
                 :88 char:15
                 + …   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) …
                 +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1

Message        : Cannot find a variable with the name 'DotNetRuntimeVersionToDotNetLinuxFxVersion'.
StackTrace     :
Exception      : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line           :     if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position       : At C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Functions\1.0.1\custom\HelperFunctions.ps1
                 :88 char:15
                 + …   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) …
                 +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1

Message        : Cannot find a variable with the name 'RuntimeVersions'.
StackTrace     :
Exception      : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line           :     if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position       : At C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Functions\1.0.1\custom\HelperFunctions.ps1
                 :88 char:15
                 + …   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) …
                 +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1
blueww commented 4 years ago

@erich-wang Would you please help to look at the Azure.Core load issue?

@peppekerstens After the issue happen, would you please run "Get-module | ft path" to see which modules are already loaded, and show us the result?

peppekerstens commented 4 years ago

new PS7 session

'clean'/new 7.0.3

C:\Users\peppe> get-module | ft path

Path
----
C:\Program Files\PowerShell\7\Microsoft.Management.Infrastructure.CimCmdlets.dll
C:\program files\powershell\7\Modules\Microsoft.PowerShell.Management\Microsoft.PowerShell.Management.psd1
C:\program files\powershell\7\Modules\Microsoft.PowerShell.Utility\Microsoft.PowerShell.Utility.psd1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\posh-git\0.7.3\posh-git.psm1
C:\program files\powershell\7\Modules\PSReadLine\PSReadLine.psm1

4.6.0

C:\Users\peppe> import-module az -requiredversion 4.6.0
Import-Module: C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Storage\2.5.0\Az.Storage.psm1:113
Line |
 113 |  Import-Module (Join-Path -Path $PSScriptRoot -ChildPath Microsoft.Azu …
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Could not load file or assembly 'Azure.Core, Version=1.3.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8'. The system cannot find the file specified.

C:\Users\peppe> get-module | ft path

Path
----
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\az\4.6.0\Az.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Accounts\2.0.1\Az.Accounts.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Advisor\1.1.1\Az.Advisor.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Aks\1.2.0\Az.Aks.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.AnalysisServices\1.1.4\Az.AnalysisServices.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.ApiManagement\2.1.0\Az.ApiManagement.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.ApplicationInsights\1.1.0\Az.ApplicationInsights.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Automation\1.4.0\Az.Automation.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Batch\3.1.0\Az.Batch.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Billing\1.0.3\Az.Billing.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Cdn\1.4.3\Az.Cdn.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.CognitiveServices\1.5.1\Az.CognitiveServices.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Compute\4.3.0\Az.Compute.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.ContainerInstance\1.0.3\Az.ContainerInstance.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.ContainerRegistry\1.1.1\Az.ContainerRegistry.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.DataBoxEdge\1.1.0\Az.DataBoxEdge.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.DataFactory\1.10.0\Az.DataFactory.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.DataLakeAnalytics\1.0.2\Az.DataLakeAnalytics.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.DataLakeStore\1.2.8\Az.DataLakeStore.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.DataShare\1.0.0\Az.DataShare.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.DeploymentManager\1.1.0\Az.DeploymentManager.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.DesktopVirtualization\1.0.0\Az.DesktopVirtualization.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.DevTestLabs\1.0.2\Az.DevTestLabs.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Dns\1.1.2\Az.Dns.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.EventGrid\1.3.0\Az.EventGrid.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.EventHub\1.5.0\Az.EventHub.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.FrontDoor\1.6.1\Az.FrontDoor.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Functions\1.0.1\Az.Functions.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.HDInsight\3.5.0\Az.HDInsight.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.HealthcareApis\1.1.0\Az.HealthcareApis.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.IotHub\2.5.0\Az.IotHub.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.KeyVault\2.1.0\Az.KeyVault.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.LogicApp\1.3.2\Az.LogicApp.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.MachineLearning\1.1.3\Az.MachineLearning.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Maintenance\1.1.0\Az.Maintenance.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.ManagedServices\1.1.0\Az.ManagedServices.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.MarketplaceOrdering\1.0.2\Az.MarketplaceOrdering.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Media\1.1.1\Az.Media.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Monitor\2.1.0\Az.Monitor.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Network\3.3.0\Az.Network.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.NotificationHubs\1.1.1\Az.NotificationHubs.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.OperationalInsights\2.3.0\Az.OperationalInsights.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.PolicyInsights\1.3.1\Az.PolicyInsights.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.PowerBIEmbedded\1.1.2\Az.PowerBIEmbedded.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.PrivateDns\1.0.3\Az.PrivateDns.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.RecoveryServices\2.11.1\Az.RecoveryServices.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.RedisCache\1.2.1\Az.RedisCache.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Relay\1.0.3\Az.Relay.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Resources\2.5.0\Az.Resources.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.ServiceBus\1.4.1\Az.ServiceBus.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.ServiceFabric\2.1.0\Az.ServiceFabric.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.SignalR\1.2.0\Az.SignalR.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Sql\2.9.1\Az.Sql.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.SqlVirtualMachine\1.1.0\Az.SqlVirtualMachine.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Storage\2.5.0\Az.Storage.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.StorageSync\1.3.0\Az.StorageSync.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.StreamAnalytics\1.0.1\Az.StreamAnalytics.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Support\1.0.0\Az.Support.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.TrafficManager\1.0.4\Az.TrafficManager.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Websites\1.11.0\Az.Websites.psm1
C:\Program Files\PowerShell\7\Microsoft.Management.Infrastructure.CimCmdlets.dll
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Functions\1.0.1\custom\HelperFunctions.ps1
C:\program files\powershell\7\Modules\Microsoft.PowerShell.Management\Microsoft.PowerShell.Management.psd1
C:\program files\powershell\7\Modules\Microsoft.PowerShell.Utility\Microsoft.PowerShell.Utility.psd1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\posh-git\0.7.3\posh-git.psm1
C:\program files\powershell\7\Modules\PSReadLine\PSReadLine.psm1

4.5.0

import-module az -requiredversion 4.5.0
Import-Module: C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Storage\2.4.0\Az.Storage.psm1:113
Line |
 113 |  Import-Module (Join-Path -Path $PSScriptRoot -ChildPath Microsoft.Azu …
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Could not load file or assembly 'Azure.Core, Version=1.2.2.0, Culture=neutral, PublicKeyToken=92742159e12e44c8'. The system cannot find the file specified.

C:\Users\peppe> get-module | ft path

Path
----
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\az\4.5.0\Az.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Accounts\2.0.1\Az.Accounts.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Advisor\1.1.1\Az.Advisor.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Aks\1.2.0\Az.Aks.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.AnalysisServices\1.1.4\Az.AnalysisServices.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.ApiManagement\2.1.0\Az.ApiManagement.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.ApplicationInsights\1.1.0\Az.ApplicationInsights.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Automation\1.3.7\Az.Automation.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Batch\3.1.0\Az.Batch.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Billing\1.0.3\Az.Billing.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Cdn\1.4.3\Az.Cdn.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.CognitiveServices\1.5.1\Az.CognitiveServices.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Compute\4.2.1\Az.Compute.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.ContainerInstance\1.0.3\Az.ContainerInstance.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.ContainerRegistry\1.1.1\Az.ContainerRegistry.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.DataBoxEdge\1.1.0\Az.DataBoxEdge.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.DataFactory\1.9.0\Az.DataFactory.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.DataLakeAnalytics\1.0.2\Az.DataLakeAnalytics.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.DataLakeStore\1.2.8\Az.DataLakeStore.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.DataShare\1.0.0\Az.DataShare.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.DeploymentManager\1.1.0\Az.DeploymentManager.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.DesktopVirtualization\1.0.0\Az.DesktopVirtualization.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.DevTestLabs\1.0.2\Az.DevTestLabs.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Dns\1.1.2\Az.Dns.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.EventGrid\1.3.0\Az.EventGrid.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.EventHub\1.5.0\Az.EventHub.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.FrontDoor\1.6.1\Az.FrontDoor.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Functions\1.0.1\Az.Functions.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.HDInsight\3.4.0\Az.HDInsight.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.HealthcareApis\1.1.0\Az.HealthcareApis.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.IotHub\2.5.0\Az.IotHub.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.KeyVault\2.0.0\Az.KeyVault.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.LogicApp\1.3.2\Az.LogicApp.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.MachineLearning\1.1.3\Az.MachineLearning.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Maintenance\1.0.0\Az.Maintenance.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.ManagedServices\1.0.2\Az.ManagedServices.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.MarketplaceOrdering\1.0.2\Az.MarketplaceOrdering.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Media\1.1.1\Az.Media.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Monitor\2.0.2\Az.Monitor.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Network\3.3.0\Az.Network.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.NotificationHubs\1.1.1\Az.NotificationHubs.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.OperationalInsights\2.3.0\Az.OperationalInsights.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.PolicyInsights\1.3.1\Az.PolicyInsights.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.PowerBIEmbedded\1.1.2\Az.PowerBIEmbedded.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.PrivateDns\1.0.3\Az.PrivateDns.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.RecoveryServices\2.11.1\Az.RecoveryServices.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.RedisCache\1.2.1\Az.RedisCache.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Relay\1.0.3\Az.Relay.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Resources\2.4.0\Az.Resources.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.ServiceBus\1.4.1\Az.ServiceBus.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.ServiceFabric\2.1.0\Az.ServiceFabric.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.SignalR\1.1.1\Az.SignalR.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Sql\2.9.1\Az.Sql.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.SqlVirtualMachine\1.1.0\Az.SqlVirtualMachine.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Storage\2.4.0\Az.Storage.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.StorageSync\1.3.0\Az.StorageSync.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.StreamAnalytics\1.0.1\Az.StreamAnalytics.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Support\1.0.0\Az.Support.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.TrafficManager\1.0.4\Az.TrafficManager.psm1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Websites\1.11.0\Az.Websites.psm1
C:\Program Files\PowerShell\7\Microsoft.Management.Infrastructure.CimCmdlets.dll
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\Az.Functions\1.0.1\custom\HelperFunctions.ps1
C:\program files\powershell\7\Modules\Microsoft.PowerShell.Management\Microsoft.PowerShell.Management.psd1
C:\program files\powershell\7\Modules\Microsoft.PowerShell.Utility\Microsoft.PowerShell.Utility.psd1
C:\Users\peppe\OneDrive\Documenten\PowerShell\Modules\posh-git\0.7.3\posh-git.psm1
C:\program files\powershell\7\Modules\PSReadLine\PSReadLine.psm1
blueww commented 4 years ago

@peppekerstens You have loaded old preview module Az.Accounts 2.0.1-preview in the powershell console. But the latest stable Az.Accounts has version 1.9.3.

Not sure why you have installed Az.Accounts 2.0.1-preview. @erich-wang, do you know what's version for? Is it for Azure Stack only?

@peppekerstens Would you please remove Az.Accounts 2.0.1-preview, and make sure Az.Accounts 1.9.3 is installed, then try again? If you don't want to remove Az.Accounts 2.0.1-preview, you can run "Import-Module Az.accounts -RequiredVersion 1.9.3" at the begin of each PSH session to make the correct Az.Accounts is loaded, them import other module of Az.

dingmeng-xue commented 4 years ago

Az.Accounts 2.0.1-preview is preview release for MSAL support. It is used in Azure Stack environment or ADFS. Since Az modules always loads the latest version of Az.Accounts, 2.0.1-preview is loaded. The latest Az.storage depends on Az.Accounts 1.9.x. Please remove 2.0.1-preview. Thanks.

mattduguid commented 4 years ago

I was also having this issue but trying to load different version of v2.5.0 using powershell 7.0.3 on ubuntu 20 LTS,

import-module az.storage Import-Module: /home/mattduguid/.local/share/powershell/Modules/Az.Storage/2.5.0/Az.Storage.psm1:113 Line | 113 | Import-Module (Join-Path -Path $PSScriptRoot -ChildPath Microsoft.Azu … | ~~~~~~~~~~~~~~~~~ | Could not load file or assembly 'Azure.Core, Version=1.3.0.0, Culture=neutral, | PublicKeyToken=92742159e12e44c8'. The system cannot find the file specified.

However if I use the following it works fine,

install-module az.storage -requiredversion 4.0.2-preview -allowprerelease import-module az.storage

blueww commented 4 years ago

@mattduguid Would you please check which version of Az.Accounts have you loaded? Would you please run Get-module and show the result?

BTW, Az.Storage 4.0.2-preview is for Azure stack. If you don't use it on Azure stack, we don't suggest you to use it.

mattduguid commented 4 years ago

@blueww we have to load 2.0.1-preview for az.accounts due to a known issue where login from linux/ADFS was taking us through the device login route and failing, using the 2.0.1-preview works as it redirects to webpage for auth

install-module az.accounts -requiredversion 2.0.1-preview -allowprerelease

With regard to Az.Storage 4.0.2-preview I tried loading a number of other versions but had same error, it was only this one that let us proceed.

blueww commented 4 years ago

@mattduguid Az.Storage 1.9.3 is released with Az.Accounts 2.5.0, and can only work with Az.Account 2.5.0 or later. az.accounts 2.0.1-preview is released much early before Az.Account 2.5.0, it can't work with Az.Storage 1.9.3. (Az.Storage 2.0.1-preview should work with it, anyway it should miss many new changes.)

For the know issue of login from linux/ADFS, do you have a issue to track it? If not, would you like to open another issue to track it, as this issue is for Az.storage load.

mattduguid commented 4 years ago

this is the link for the device login issue -> https://github.com/Azure/azure-powershell/issues/9427

i'll test that combination soon of Az.Storage 1.9.3 & Az.Accounts 2.5.0 thanks 👍🏼

mattduguid commented 4 years ago

@blueww following non-preview combo has worked without error thanks

Install-Module Az.Accounts -requiredversion 1.9.3 Install-Module Az.Storage -requiredversion 2.5.0 Import-Module -Name az.accounts Import-Module -Name az.storage Connect-AzAccount

blueww commented 4 years ago

Thanks @mattduguid for the update! I will close this issue as you issue is resolved, and @peppekerstens have no responds for a long time.

Feel free to contact us again if need any further assistance on Azure Powershell.