azure-powershell
azure-powershell copied to clipboard
`Az.Resources` v6.6.1 fails to import to Azure Automation Account
Edit 2024-01-03:
- PowerShell 7.2 is GA in Automation Account and works great with the newest Az modules.
- If still using 5.1: See temp workaround if you are affected.
Description
Tried three times to import Az.Resources
v6.6.1 to an Azure Automation Account, but it fails.
I imported/updated Az.Accounts
to v2.12.2 prior to this.
This is using the built in "Browse gallery" method.
Issue script & Debug output
None.
Environment data
5.1 in Azure Automation Account
Module versions
Az.Accounts v2.12.2
Az.Resources v6.6.1
Error output
Error importing the module Az.Resources. Import failed with the following error: Orchestrator.Shared.AsyncModuleImport.ModuleImportException: An error occurred when trying to import the module to an internal PowerShell session. Either the module dependencies are not imported correctly or the module is unsupported. Internal Error Message: The type initializer for 'Microsoft.Azure.Commands.Common.AzModule' threw an exception. The type initializer for 'Microsoft.Azure.Commands.Common.AzModule' threw an exception. . at Orchestrator.Activities.SetModuleVersion.GetPsModuleVersion(String moduleName, String moduleFullPath, Guid accountId, Guid moduleVersionId, InitialSessionState defaultSessionState) at Orchestrator.Activities.SetModuleVersion.InsertModuleVersion(String moduleName, ModuleLanguage moduleLanguage, String pythonModuleVersion, String moduleFullyQualifiedName, ActivitiesMetadataWorkflowExtension activitiesMetadataWorkflowExtension, Guid accountId, Guid moduleVersionId, Int64 moduleContentByteSize, ContentUriInfo contentUri, String storageUri, Int32 moduleVersion) at Orchestrator.Activities.SetModuleVersion.ExecuteInternal(CodeActivityContext context, String moduleName, ModuleLanguage moduleLanguage, String pythonModuleVersion, String modulePath, Guid accountId, Guid moduleVersionId, Int64 moduleContentByteSize, String storageUri, Int32 moduleVersion) at Orchestrator.Activities.SetModuleVersion.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
More info:
Running locally, Az.Resources
v6.6.1 fails to import on Windows PowerShell 5.1, but only when using VSCode and the VSCode PowerShell Extension.
- PowerShell.exe terminal works fine.
- PowerShell ISE works fine
- VSCode + PS extension + PowerShell 7.3.x = Success
- VSCode + PS extension + Windows PowerShell 5.1 = Fail
- It had no problems with
Az.Accounts
v2.12.1 andAz.Resources
v6.6.0.
- It had no problems with
Some assembly conflict?
Output with verbose and debug set to 'Continue'.
Click to view
PS C:\Users\ORB\<redacted>> Import-Module -Name Az.Resources
VERBOSE: Loading module from path 'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\Az.Resources.psd1'.
VERBOSE: Cannot verify the Microsoft .NET Framework version 4.7.2 because it is not included in the list of permitted versions.
VERBOSE: Loading 'Assembly' from path 'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\Microsoft.Azure.Management.Authorization.dll'.
VERBOSE: Loading 'Assembly' from path 'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\Microsoft.Azure.Management.Authorization.dll'.
VERBOSE: Loading 'Assembly' from path 'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\Microsoft.Azure.Management.ResourceManager.dll'.
VERBOSE: Loading 'Assembly' from path 'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\Microsoft.Azure.Management.ResourceManager.dll'.
VERBOSE: Loading 'Assembly' from path 'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\Microsoft.Azure.Management.ManagementGroups.dll'.
VERBOSE: Loading 'Assembly' from path 'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\Microsoft.Azure.Management.ManagementGroups.dll'.
VERBOSE: Loading 'Assembly' from path 'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\Microsoft.Extensions.Caching.Abstractions.dll'.
VERBOSE: Loading 'Assembly' from path 'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\Microsoft.Extensions.Caching.Abstractions.dll'.
VERBOSE: Loading 'Assembly' from path 'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\Microsoft.Extensions.Caching.Memory.dll'.
VERBOSE: Loading 'Assembly' from path 'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\Microsoft.Extensions.Caching.Memory.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\.vscode\extensions\ms-vscode.powershell-2023.3.3\modules\PowerShellEditorServices\bin\Common\Microsoft.Extensions.DependencyInjection.Abstractions.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\.vscode\extensions\ms-vscode.powershell-2023.3.3\modules\PowerShellEditorServices\bin\Common\Microsoft.Extensions.DependencyInjection.Abstractions.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\.vscode\extensions\ms-vscode.powershell-2023.3.3\modules\PowerShellEditorServices\bin\Common\Microsoft.Extensions.Options.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\.vscode\extensions\ms-vscode.powershell-2023.3.3\modules\PowerShellEditorServices\bin\Common\Microsoft.Extensions.Options.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\.vscode\extensions\ms-vscode.powershell-2023.3.3\modules\PowerShellEditorServices\bin\Common\Microsoft.Extensions.Primitives.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\.vscode\extensions\ms-vscode.powershell-2023.3.3\modules\PowerShellEditorServices\bin\Common\Microsoft.Extensions.Primitives.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\.vscode\extensions\ms-vscode.powershell-2023.3.3\modules\PowerShellEditorServices\bin\Common\System.Runtime.CompilerServices.Unsafe.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\.vscode\extensions\ms-vscode.powershell-2023.3.3\modules\PowerShellEditorServices\bin\Common\System.Runtime.CompilerServices.Unsafe.dll'.
VERBOSE: Loading 'Assembly' from path 'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\MSGraph.Autorest\bin\Az.MSGraph.private.dll'.
VERBOSE: Loading 'Assembly' from path 'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\MSGraph.Autorest\bin\Az.MSGraph.private.dll'.
VERBOSE: Loading 'Assembly' from path 'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\Authorization.Autorest\bin\Az.Authorization.private.dll'.
VERBOSE: Loading 'Assembly' from path 'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\Authorization.Autorest\bin\Az.Authorization.private.dll'.
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\Resources.format.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\ResourceManager.format.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\ResourceManager.generated.format.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\Tags.format.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\MSGraph.Autorest\Az.MSGraph.format.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path
'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\Authorization.Autorest\Az.Authorization.format.ps1xml'.
VERBOSE: Loading module from path 'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\MSGraph.Autorest\Az.MSGraph.psm1'.
Loaded Module 'Az.Accounts'
VERBOSE: Importing cmdlet 'Export-CmdletSurface'.
VERBOSE: Importing cmdlet 'Export-ExampleStub'.
VERBOSE: Importing cmdlet 'Export-FormatPs1xml'.
VERBOSE: Importing cmdlet 'Export-HelpMarkdown'.
VERBOSE: Importing cmdlet 'Export-ModelSurface'.
VERBOSE: Importing cmdlet 'Export-ProxyCmdlet'.
VERBOSE: Importing cmdlet 'Export-Psd1'.
VERBOSE: Importing cmdlet 'Export-TestStub'.
VERBOSE: Importing cmdlet 'Get-CommonParameter'.
VERBOSE: Importing cmdlet 'Get-ModuleGuid'.
VERBOSE: Importing cmdlet 'Get-ScriptCmdlet'.
VERBOSE: Importing cmdlet 'Add-AzADApplicationKey_Add'.
VERBOSE: Importing cmdlet 'Add-AzADApplicationKey_AddExpanded'.
VERBOSE: Importing cmdlet 'Add-AzADApplicationPassword_Add'.
VERBOSE: Importing cmdlet 'Add-AzADApplicationPassword_AddExpanded'.
VERBOSE: Importing cmdlet 'Add-AzADServicePrincipalKey_Add'.
VERBOSE: Importing cmdlet 'Add-AzADServicePrincipalKey_AddExpanded'.
VERBOSE: Importing cmdlet 'Add-AzADServicePrincipalPassword_Add'.
VERBOSE: Importing cmdlet 'Add-AzADServicePrincipalPassword_AddExpanded'.
VERBOSE: Importing cmdlet 'Get-AzADAppFederatedCredential_Get'.
VERBOSE: Importing cmdlet 'Get-AzADAppFederatedCredential_List'.
VERBOSE: Importing cmdlet 'Get-AzADApplication_Get'.
VERBOSE: Importing cmdlet 'Get-AzADApplication_List'.
VERBOSE: Importing cmdlet 'Get-AzADGroupMember_List'.
VERBOSE: Importing cmdlet 'Get-AzADGroup_Get'.
VERBOSE: Importing cmdlet 'Get-AzADGroup_List'.
VERBOSE: Importing cmdlet 'Get-AzADOrganization_List'.
VERBOSE: Importing cmdlet 'Get-AzADServicePrincipal_Get'.
VERBOSE: Importing cmdlet 'Get-AzADServicePrincipal_List'.
VERBOSE: Importing cmdlet 'Get-AzADUserOwnedApplication_List'.
VERBOSE: Importing cmdlet 'Get-AzADUserOwnedObject_List'.
VERBOSE: Importing cmdlet 'Get-AzADUserSigned_Get'.
VERBOSE: Importing cmdlet 'Get-AzADUser_Get'.
VERBOSE: Importing cmdlet 'Get-AzADUser_List'.
VERBOSE: Importing cmdlet 'New-AzADAppFederatedCredential_CreateExpanded'.
VERBOSE: Importing cmdlet 'New-AzADApplication_CreateExpanded'.
VERBOSE: Importing cmdlet 'New-AzADGroupGraphRefMember_Create'.
VERBOSE: Importing cmdlet 'New-AzADGroupGraphRefMember_CreateExpanded'.
VERBOSE: Importing cmdlet 'New-AzADGroup_CreateExpanded'.
VERBOSE: Importing cmdlet 'New-AzADOrganization_Create'.
VERBOSE: Importing cmdlet 'New-AzADOrganization_CreateExpanded'.
VERBOSE: Importing cmdlet 'New-AzADServicePrincipal_CreateExpanded'.
VERBOSE: Importing cmdlet 'New-AzADUser_CreateExpanded'.
VERBOSE: Importing cmdlet 'Remove-AzADAppFederatedCredential_Delete'.
VERBOSE: Importing cmdlet 'Remove-AzADApplicationKey_Remove'.
VERBOSE: Importing cmdlet 'Remove-AzADApplicationKey_RemoveExpanded'.
VERBOSE: Importing cmdlet 'Remove-AzADApplicationPassword_Remove'.
VERBOSE: Importing cmdlet 'Remove-AzADApplicationPassword_RemoveExpanded'.
VERBOSE: Importing cmdlet 'Remove-AzADApplication_Delete'.
VERBOSE: Importing cmdlet 'Remove-AzADGroupRefMember_Delete'.
VERBOSE: Importing cmdlet 'Remove-AzADGroup_Delete'.
VERBOSE: Importing cmdlet 'Remove-AzADServicePrincipalKey_Remove'.
VERBOSE: Importing cmdlet 'Remove-AzADServicePrincipalKey_RemoveExpanded'.
VERBOSE: Importing cmdlet 'Remove-AzADServicePrincipalPassword_Remove'.
VERBOSE: Importing cmdlet 'Remove-AzADServicePrincipalPassword_RemoveExpanded'.
VERBOSE: Importing cmdlet 'Remove-AzADServicePrincipal_Delete'.
VERBOSE: Importing cmdlet 'Remove-AzADUser_Delete'.
VERBOSE: Importing cmdlet 'Update-AzADAppFederatedCredential_UpdateExpanded'.
VERBOSE: Importing cmdlet 'Update-AzADApplication_UpdateExpanded'.
VERBOSE: Importing cmdlet 'Update-AzADGroup_UpdateExpanded'.
VERBOSE: Importing cmdlet 'Update-AzADServicePrincipal_UpdateExpanded'.
VERBOSE: Importing cmdlet 'Update-AzADUser_UpdateExpanded'.
Register-AzModule : The type initializer for 'Microsoft.Azure.Commands.Common.AzModule' threw an exception.
At C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\MSGraph.Autorest\Az.MSGraph.psm1:49 char:13
+ $VTable = Register-AzModule
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Register-AzModule], TypeInitializationException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Common.RegisterAzModule
PS C:\Users\ORB\<redacted>>PS
Output of Resolve-AzError
Click to view
HistoryId: 8
Message : The type initializer for 'Microsoft.Azure.Commands.Common.AzModule' threw an exception.
StackTrace : at Microsoft.Azure.Commands.Common.RegisterAzModule.ProcessRecord()
Exception : System.TypeInitializationException
InvocationInfo : {Register-AzModule}
Line : $VTable = Register-AzModule
Position : At C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\MSGraph.Autorest\Az.MSGraph.psm1:49 char:13
+ $VTable = Register-AzModule
+ ~~~~~~~~~~~~~~~~~
HistoryId : 8
Message : Attempted to access an element as a type incompatible with the array.
StackTrace : at System.Collections.Generic.List`1.Add(T item)
at Microsoft.Azure.Commands.Common.AzModule..cctor()
Exception : System.ArrayTypeMismatchException
InvocationInfo : {Register-AzModule}
Line : $VTable = Register-AzModule
Position : At C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\MSGraph.Autorest\Az.MSGraph.psm1:49 char:13
+ $VTable = Register-AzModule
+ ~~~~~~~~~~~~~~~~~
HistoryId : 8
HistoryId: 5
Message : The type initializer for 'Microsoft.Azure.Commands.Common.AzModule' threw an exception.
StackTrace : at Microsoft.Azure.Commands.Common.RegisterAzModule.ProcessRecord()
Exception : System.TypeInitializationException
InvocationInfo : {Register-AzModule}
Line : $VTable = Register-AzModule
Position : At C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\MSGraph.Autorest\Az.MSGraph.psm1:49 char:13
+ $VTable = Register-AzModule
+ ~~~~~~~~~~~~~~~~~
HistoryId : 5
Message : Attempted to access an element as a type incompatible with the array.
StackTrace : at System.Collections.Generic.List`1.Add(T item)
at Microsoft.Azure.Commands.Common.AzModule..cctor()
Exception : System.ArrayTypeMismatchException
InvocationInfo : {Register-AzModule}
Line : $VTable = Register-AzModule
Position : At C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\MSGraph.Autorest\Az.MSGraph.psm1:49 char:13
+ $VTable = Register-AzModule
+ ~~~~~~~~~~~~~~~~~
HistoryId : 5
HistoryId: 2
Message : The type initializer for 'Microsoft.Azure.Commands.Common.AzModule' threw an exception.
StackTrace : at Microsoft.Azure.Commands.Common.RegisterAzModule.ProcessRecord()
Exception : System.TypeInitializationException
InvocationInfo : {Register-AzModule}
Line : $VTable = Register-AzModule
Position : At C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\MSGraph.Autorest\Az.MSGraph.psm1:49 char:13
+ $VTable = Register-AzModule
+ ~~~~~~~~~~~~~~~~~
HistoryId : 2
Message : Attempted to access an element as a type incompatible with the array.
StackTrace : at System.Collections.Generic.List`1.Add(T item)
at Microsoft.Azure.Commands.Common.AzModule..cctor()
Exception : System.ArrayTypeMismatchException
InvocationInfo : {Register-AzModule}
Line : $VTable = Register-AzModule
Position : At C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\MSGraph.Autorest\Az.MSGraph.psm1:49 char:13
+ $VTable = Register-AzModule
+ ~~~~~~~~~~~~~~~~~
HistoryId : 2
HistoryId: 1
Message : The type initializer for 'Microsoft.Azure.Commands.Common.AzModule' threw an exception.
StackTrace : at Microsoft.Azure.Commands.Common.RegisterAzModule.ProcessRecord()
Exception : System.TypeInitializationException
InvocationInfo : {Register-AzModule}
Line : $VTable = Register-AzModule
Position : At C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\MSGraph.Autorest\Az.MSGraph.psm1:49 char:13
+ $VTable = Register-AzModule
+ ~~~~~~~~~~~~~~~~~
HistoryId : 1
Message : Attempted to access an element as a type incompatible with the array.
StackTrace : at System.Collections.Generic.List`1.Add(T item)
at Microsoft.Azure.Commands.Common.AzModule..cctor()
Exception : System.ArrayTypeMismatchException
InvocationInfo : {Register-AzModule}
Line : $VTable = Register-AzModule
Position : At C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.6.1\MSGraph.Autorest\Az.MSGraph.psm1:49 char:13
+ $VTable = Register-AzModule
+ ~~~~~~~~~~~~~~~~~
HistoryId : 1
Workaround for running locally
230915: vscode-powershell
won't fix with 5.1, blaims shortcomings with Windows PowerShell 5.1 (or rather .NET Framework). Ref 1, Ref 2.
- Don't use VSCode + vscode-powershell + Windows PowerShell 5.1 (use PowerShell 7.3.x instead), or
- Install previous version of mentioned modules
Workaround for running in Azure Automation Account
230915: Az.Accounts 2.13.0 works with Az.Resources 6.10.0 and PowerShell 5.1, so seems fixed.
- Download previous version of mentioned modules manually from PowerShellGallery.
- Repackage them into a zip where:
- Zip file name:
<modulename>.zip
, example:Az.Accounts.zip
- Root folder name:
<modulename>
, example:Az.Accounts
- Child directory name:
<version>
, example:2.12.1
.
- Zip file name:
Az.Accounts.zip
|- Az.Accounts
|- 2.12.1
|- <put content of nupkg file from PowerShellGallery here>
Please vote for the ability to import specific module versions to Automation Accounts, so we don't have to do this manually next time it happens:
- https://feedback.azure.com/d365community/idea/5cd4fdd2-6ae3-ed11-a81c-0022485030d1
More info:
Running locally,
Az.Resources
v6.6.1 fails to import on Windows PowerShell 5.1, but only when using VSCode and the VSCode PowerShell Extension.
- PowerShell.exe terminal works fine.
- PowerShell ISE works fine
- VSCode with PS extension had no problems with
Az.Accounts
v2.12.1 andAz.Resources
v6.6.0.Some assembly conflict?
Output with verbose and debug set to 'Continue'.
Click to view Output of
Resolve-AzError
Click to view
Update: Issue is present in Powershell.exe (v5.1) on Windows Server. Previous versions do not have issue. @wyunchi-ms / @isra-fel can you help to triage?
Thanks for the thorough investigation @o-l-a-v . We are looking into this problem.
I was able to reproduce with (a) vscode and (b) azure automation, looks like related to our recent update of Newtonsoft.Json, still investigating.
@bnichms I can't reproduce on Windows Server 2022. What version did you use? Can you run the following script and share the result after reproducing?
[System.AppDomain]::CurrentDomain.GetAssemblies() | select -Property FullName,Location | sort -Property FullName | fl
I am seeing this in GCC High (Azure Gov) as well.
Same here in several automation accounts. And not only Az.Resources. Also: Az.Advisor Az.Aks Az.Compute Az.DesktopVirtualization Az.EventHub Az.Kusto
Error message: Error importing the module Az.Advisor. Import failed with the following error: Orchestrator.Shared.AsyncModuleImport.ModuleImportException: An error occurred when trying to import the module to an internal PowerShell session. Either the module dependencies are not imported correctly or the module is unsupported. Internal Error Message: The type initializer for 'Microsoft.Azure.Commands.Common.AzModule' threw an exception. . at Orchestrator.Activities.SetModuleVersion.GetPsModuleVersion(String moduleName, String moduleFullPath, Guid accountId, Guid moduleVersionId, InitialSessionState defaultSessionState) at Orchestrator.Activities.SetModuleVersion.InsertModuleVersion(String moduleName, ModuleLanguage moduleLanguage, String pythonModuleVersion, String moduleFullyQualifiedName, ActivitiesMetadataWorkflowExtension activitiesMetadataWorkflowExtension, Guid accountId, Guid moduleVersionId, Int64 moduleContentByteSize, ContentUriInfo contentUri, String storageUri, Int32 moduleVersion) at Orchestrator.Activities.SetModuleVersion.ExecuteInternal(CodeActivityContext context, String moduleName, ModuleLanguage moduleLanguage, String pythonModuleVersion, String modulePath, Guid accountId, Guid moduleVersionId, Int64 moduleContentByteSize, String storageUri, Int32 moduleVersion) at Orchestrator.Activities.SetModuleVersion.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
In Runtime 7.1 already Az.Accounts failes: Error message: Error importing the module Az.Accounts. Import failed with the following error: Orchestrator.Shared.AsyncModuleImport.ModuleImportException: An error occurred when trying to import the module to an internal PowerShell session. Either the module dependencies are not imported correctly or the module is unsupported. Internal Error Message: Import-Module: C:\Users\Client\Temp\JGQKZQJGNR\Az.Accounts\Az.Accounts.psm1:87 Line | 87 | Import-Module (Join-Path -Path $PSScriptRoot -ChildPath Microsoft.Azu … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Could not load file or assembly 'Newtonsoft.Json, Version=13.0.0.0, | Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. The system cannot | find the file specified. . at Orchestrator.Activities.SetModuleVersion.GetPs7ModuleVersion(String moduleName, String moduleFullPath, Guid accountId, Guid moduleVersionId, InitialSessionState defaultSessionState) at Orchestrator.Activities.SetModuleVersion.InsertModuleVersion(String moduleName, ModuleLanguage moduleLanguage, String pythonModuleVersion, String moduleFullyQualifiedName, ActivitiesMetadataWorkflowExtension activitiesMetadataWorkflowExtension, Guid accountId, Guid moduleVersionId, Int64 moduleContentByteSize, ContentUriInfo contentUri, String storageUri, Int32 moduleVersion) at Orchestrator.Activities.SetModuleVersion.ExecuteInternal(CodeActivityContext context, String moduleName, ModuleLanguage moduleLanguage, String pythonModuleVersion, String modulePath, Guid accountId, Guid moduleVersionId, Int64 moduleContentByteSize, String storageUri, Int32 moduleVersion) at Orchestrator.Activities.SetModuleVersion.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
I have seen this issue too - same error as above and runbooks that rely on these modules are failing/suspended... The following updates in two of my Azure subscriptions (automated using an update runbook downloaded from MS's gallery) have failed on 30/05 AZ.Compute from version 5.7.0 to 5.7.1 AZ.Resources from version 6.6.0 to 6.6.1
Az.Accounts (which is a dependency of both) gets successfully updated to v 2.12.2. Attempts to revert back to an earlier version of both modules also fail - when I delete the modules I am able to revert back to Az.Accounts v2.12.1 but then when I try and revert back to Az.Compute 5.7.0 or Az.Resources 6.6.0 they both first update Az.Accounts to v2.12.2 (despite documentation saying their dependency is v2.12.1) before installation and both attempts subsequently fail
Update: The only way to rollback to the older versions of these modules (that worked for me) is to delete them from your automation accounts and install them from a local file, manually downloaded from the PowerShell Gallery and rename the *.nupg file as a *.zip file as per the workaround posted above.
Neither using PowerShell nor deploying to Azure either from within the Portal or from the PowerShell Gallery webpage worked. Modules that have been affected for me were:
- Az.Accounts had to rollback to v2.12.1
- Az.Compute had to rollback to v5.7.0
- Az.Network had to rollback to v5.6.0
- Az.Resources had to rollback to v6.6.0
- Az.SQL had to rollback to v4.5.0
- Az.Storage had to rollback to v5.5.0
Seeing the same problem after my AA account was auto updated to new Az version. Multiple Az submodules are in a import failed state, and Runbooks trying to use them will just outright fail
Anyone tried Automation Account + not Windows PowerShell 5.1? I haven't because newer PowerShell versions still are in preview (for Azure Automation Account).
Lets hope Microsoft can implement two new test cases that must succeed before launching a stable version of any Az.*
module in the future:
- Azure Automation Account + Windows PowerShell 5.1
- Import/install on the Automation Account itself
- Import and use from a PowerShell runbook (easy to test auth with Managed Identity)
- VSCode + vscode-powershell + Windows PowerShell 5.1
- Import
FYI, I spoke with MS support on this and product is aware. They are working on a hotfix.
here is our guidance to mitigate the issue:
• Download previous version of mentioned modules manually from PowerShellGallery.
o Az.Accounts v2.12.1
o Az.Resources v6.6.0
• Repackage them into a zip where:
o Zip file name:
Here is a list of know versions that are impacted by this issue, an older version would also mitigate the issue: 6.6.0 6.5.3 6.2.0 6.0.1
I was able to reproduce with (a) vscode and (b) azure automation, looks like related to our recent update of Newtonsoft.Json, still investigating.
@bnichms I can't reproduce on Windows Server 2022. What version did you use? Can you run the following script and share the result after reproducing?
[System.AppDomain]::CurrentDomain.GetAssemblies() | select -Property FullName,Location | sort -Property FullName | fl
Agreed. We have found it is not widespread across Windows Server/Azure Stack HCI. We found it is affecting systems which are running our E2E testing. The problem in triaging thus far is that the error only occurs during our test runs. What we are seeing is that logging in and trying to manually repro does not result in the error.
We are still triaging.
Received the same exception while attempting to upgrade RunAs automation account from using AzureRM to Az
Manually installing Az.Accounts (2.12.1) and Az.Resources (6.6.0) via workaround gets the conversion completed and scripts running again with managed identity
The Azure Automation team is investigating and working on the identified issue, the workaround is to download the Az.Accounts v2.12.1 from the PowerShell gallery and upload it with the following file structure:
Az.Accounts.zip
|- Az.Accounts
|- 2.12.1
|- <put content of nupkg file from PowerShellGallery here>
All the modules having a dependency on the Az.Accounts module should work with the hot-fix.
I hit a similar issue on one my environments: https://github.com/Azure/azure-powershell/issues/21690
I hit a similar issue on one my environments: #21690
@isra-fel please see this issue posted by one of our team members (which has relevant repro steps and other information)
I hit a similar issue on one my environments: #21690
@isra-fel please see this issue posted by one of our team members (which has relevant repro steps and other information)
FYI, I spoke with MS support on this and product is aware. They are working on a hotfix.
Hit this issue today with Az.Compute. Do we have ETA on hotfix?
https://learn.microsoft.com/en-us/azure/automation/automation-update-azure-modules
No eta yet per my Microsoft case I have opened.
https://learn.microsoft.com/en-us/azure/automation/automation-update-azure-modules
No eta yet per my Microsoft case I have opened.
Yeah. I had the same with Microsoft. Thanks for that doc link.
Hi all, I've been encountering the same issue and have been trying to update the package manually due to the latest version of Az.Accounts causing me issues. My upload keeps failing even with the provided folder structure for reference. Currently, this is mine:
Anyone have any ideas or able to help me out? Or will I have to wait for the update?
This is the error I've got on my automation account
Any information is appreciated. Thanks
Hi all, I've been encountering the same issue and have been trying to update the package manually due to the latest version of Az.Accounts causing me issues. My upload keeps failing even with the provided folder structure for reference. Currently, this is mine:
Anyone have any ideas or able to help me out? Or will I have to wait for the update?
This is the error I've got on my automation account
Any information is appreciated. Thanks
@shootex20 change the extension on the .nupkg file to be a .zip, extract the contents into that versioned folder, then try the import.
Az.Accounts.zip -->|Az.Accounts ------>| 2.12.1 --------->|--extracted contents of the nupkg archive
Update: root cause is that the way how the Azure Automation PS runtime is configured to resolve the reference to the Newtonsoft.Json library had an unexpected conflict with Az.Accounts, causing 2 versions of the assembly being loaded and used together, hence the error. We are working with Automation team to modify the configuration to unblock Azure PowerShell.
@isra-fel
What about vscode-powershell + Windows PowerShell 5.1?
We are hitting this issue on Azure Stack HCI 22H2 builds as well when running it inside a PSRemote session from Jenkins, VSCode, or just PS7. Works locally on the box via RDP ;-(
Import-Module -Name "Az.StackHCI" -Force -ErrorAction Stop -Verbose
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Az.StackHCI\1.4.3\Az.StackHCI.psd1'.
VERBOSE: Removing the imported "Update-AzStackHciCluster" function.
VERBOSE: Removing the imported "Unregister-AzStackHCI" function.
VERBOSE: Removing the imported "Test-AzStackHCIConnection" function.
VERBOSE: Removing the imported "Set-AzStackHCI" function.
VERBOSE: Removing the imported "Remove-AzStackHCIVMAttestation" function.
VERBOSE: Removing the imported "Remove-AzStackHCIRemoteSupport" function.
VERBOSE: Removing the imported "Remove-AzStackHciExtension" function.
VERBOSE: Removing the imported "Remove-AzStackHciCluster" function.
VERBOSE: Removing the imported "Remove-AzStackHciArcSetting" function.
VERBOSE: Removing the imported "Register-AzStackHCI" function.
VERBOSE: Removing the imported "New-AzStackHciExtension" function.
VERBOSE: Removing the imported "New-AzStackHciCluster" function.
VERBOSE: Removing the imported "New-AzStackHciArcSetting" function.
VERBOSE: Removing the imported "Install-AzStackHCIRemoteSupport" function.
VERBOSE: Removing the imported "Get-AzStackHCIVMAttestation" function.
VERBOSE: Removing the imported "Get-AzStackHCIRemoteSupportSessionHistory" function.
VERBOSE: Removing the imported "Get-AzStackHCIRemoteSupportAccess" function.
VERBOSE: Removing the imported "Get-AzStackHciExtension" function.
VERBOSE: Removing the imported "Get-AzStackHciCluster" function.
VERBOSE: Removing the imported "Get-AzStackHciArcSetting" function.
VERBOSE: Removing the imported "Enable-AzStackHCIRemoteSupport" function.
VERBOSE: Removing the imported "Enable-AzStackHCIAttestation" function.
VERBOSE: Removing the imported "Disable-AzStackHCIRemoteSupport" function.
VERBOSE: Removing the imported "Disable-AzStackHCIAttestation" function.
VERBOSE: Removing the imported "Add-AzStackHCIVMAttestation" function.
VERBOSE: Cannot verify the Microsoft .NET Framework version 4.7.2 because it is not included in the list of permitted versions.
VERBOSE: Loading 'Assembly' from path 'C:\Program Files\WindowsPowerShell\Modules\Az.StackHCI\1.4.3\bin\Az.StackHCI.private.dll'.
VERBOSE: Loading 'Assembly' from path 'C:\Program Files\WindowsPowerShell\Modules\Az.StackHCI\1.4.3\bin\Az.StackHCI.private.dll'.
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Program Files\WindowsPowerShell\Modules\Az.StackHCI\1.4.3\Az.StackHCI.format.ps1xml'.
VERBOSE: Populating RepositorySourceLocation property for module Az.StackHCI.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Az.StackHCI\1.4.3\./Az.StackHCI.psm1'.
Register-AzModule : The type initializer for 'Microsoft.Azure.Commands.Common.AzModule' threw an exception.
At C:\Program Files\WindowsPowerShell\Modules\Az.StackHCI\1.4.3\Az.StackHCI.psm1:49 char:13
+ $VTable = Register-AzModule
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Register-AzModule], TypeInitializationException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Common.RegisterAzModule
VERBOSE: Importing function 'Add-AzStackHCIVMAttestation'.
VERBOSE: Importing function 'Disable-AzStackHCIAttestation'.
VERBOSE: Importing function 'Disable-AzStackHCIRemoteSupport'.
VERBOSE: Importing function 'Enable-AzStackHCIAttestation'.
VERBOSE: Importing function 'Enable-AzStackHCIRemoteSupport'.
VERBOSE: Importing function 'Get-AzStackHciArcSetting'.
VERBOSE: Importing function 'Get-AzStackHciCluster'.
VERBOSE: Importing function 'Get-AzStackHciExtension'.
VERBOSE: Importing function 'Get-AzStackHCIRemoteSupportAccess'.
VERBOSE: Importing function 'Get-AzStackHCIRemoteSupportSessionHistory'.
VERBOSE: Importing function 'Get-AzStackHCIVMAttestation'.
VERBOSE: Importing function 'Install-AzStackHCIRemoteSupport'.
VERBOSE: Importing function 'New-AzStackHciArcSetting'.
VERBOSE: Importing function 'New-AzStackHciCluster'.
VERBOSE: Importing function 'New-AzStackHciExtension'.
VERBOSE: Importing function 'Register-AzStackHCI'.
VERBOSE: Importing function 'Remove-AzStackHciArcSetting'.
VERBOSE: Importing function 'Remove-AzStackHciCluster'.
VERBOSE: Importing function 'Remove-AzStackHciExtension'.
VERBOSE: Importing function 'Remove-AzStackHCIRemoteSupport'.
VERBOSE: Importing function 'Remove-AzStackHCIVMAttestation'.
VERBOSE: Importing function 'Set-AzStackHCI'.
VERBOSE: Importing function 'Test-AzStackHCIConnection'.
VERBOSE: Importing function 'Unregister-AzStackHCI'.
VERBOSE: Importing function 'Update-AzStackHciCluster'.
Get-Module -Name "Az.R*" -ListAvailable
Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 6.6.1 Az.Resources {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzRoleAssignment, New-AzRoleAssignment...}
Import-Module -Name "Az.Resources" -Force
Register-AzModule : The type initializer for 'Microsoft.Azure.Commands.Common.AzModule' threw an exception.
At C:\Program Files\WindowsPowerShell\Modules\Az.Resources\6.6.1\MSGraph.Autorest\Az.MSGraph.psm1:49 char:13
+ $VTable = Register-AzModule
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Register-AzModule], TypeInitializationException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Common.RegisterAzModule
Register-AzModule : The type initializer for 'Microsoft.Azure.Commands.Common.AzModule' threw an exception.
At C:\Program Files\WindowsPowerShell\Modules\Az.Resources\6.6.1\Authorization.Autorest\Az.Authorization.psm1:49 char:13
+ $VTable = Register-AzModule
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Register-AzModule], TypeInitializationException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Common.RegisterAzModule
RunspaceId : 4be9f51e-d88d-4391-a918-dd5b9051e7b2
InnerException : False
Exception : System.TypeInitializationException: The type initializer for
'Microsoft.Azure.Commands.Common.AzModule' threw an exception. --->
System.ArrayTypeMismatchException: Attempted to access an element as a type incompatible with the
array.
at System.Collections.Generic.List`1.Add(T item)
at Microsoft.Azure.Commands.Common.AzModule..cctor()
--- End of inner exception stack trace ---
at Microsoft.Azure.Commands.Common.AzModule..ctor(ICommandRuntime runtime)
at Microsoft.Azure.Commands.Common.RegisterAzModule.ProcessRecord()
Message : The type initializer for 'Microsoft.Azure.Commands.Common.AzModule' threw an exception.
StackTrace : at Microsoft.Azure.Commands.Common.AzModule..ctor(ICommandRuntime runtime)
at Microsoft.Azure.Commands.Common.RegisterAzModule.ProcessRecord()
HelpLink :
ErrorDetails :
ErrorCategory : CloseError: (:) [Register-AzModule], TypeInitializationException
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at <ScriptBlock>, C:\Program
Files\WindowsPowerShell\Modules\Az.Resources\6.6.1\MSGraph.Autorest\Az.MSGraph.psm1: line 49
at <ScriptBlock>, <No file>: line 13
RunspaceId : 4be9f51e-d88d-4391-a918-dd5b9051e7b2
InnerException : False
Exception : System.ArrayTypeMismatchException: Attempted to access an element as a type incompatible with the
array.
at System.Collections.Generic.List`1.Add(T item)
at Microsoft.Azure.Commands.Common.AzModule..cctor()
Message : Attempted to access an element as a type incompatible with the array.
StackTrace : at System.Collections.Generic.List`1.Add(T item)
at Microsoft.Azure.Commands.Common.AzModule..cctor()
HelpLink :
ErrorDetails :
ErrorCategory : CloseError: (:) [Register-AzModule], TypeInitializationException
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at <ScriptBlock>, C:\Program
Files\WindowsPowerShell\Modules\Az.Resources\6.6.1\MSGraph.Autorest\Az.MSGraph.psm1: line 49
at <ScriptBlock>, <No file>: line 13
Note for anyone still coming across this - Az.Sql 4.6.0 requires Az.Accounts 2.12.2, so if you're running SQL automations you'll need to install Az.Sql 4.5.0 manually as well.
Is this issue fixed in: az.Resources 6.7.0 and az.accounts 2.12.3?
Not for vscode-powershell + Windows PowerShell 5.1 x64 at least. Got following error when trying to import Az.Monitor after having imported Az.Accounts v2.12.3.
PS > Resolve-AzError
Resolve-AzError : Method 'get_SerializationSettings' in type 'Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient' from
assembly 'Microsoft.Azure.PowerShell.Clients.ResourceManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not
have an implementation.
At line:1 char:1
+ Resolve-AzError
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Resolve-AzError], TypeLoadException
+ FullyQualifiedErrorId : System.TypeLoadException,Microsoft.Azure.Commands.Profile.Errors.ResolveError
PS >
Tried to import Az.Resources with verbose enabled.
Click to expand
PS > Import-Module -Name 'Az.Resources' -Verbose
VERBOSE: Loading module from path 'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.7.0\Az.Resources.psd1'.
VERBOSE: Cannot verify the Microsoft .NET Framework version 4.7.2 because it is not included in the list of permitted versions.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.7.0\Microsoft.Azure.Management.Authorization.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.7.0\Microsoft.Azure.Management.Authorization.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.7.0\Microsoft.Azure.Management.ResourceManager.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.7.0\Microsoft.Azure.Management.ResourceManager.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.7.0\Microsoft.Azure.Management.ManagementGroups.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.7.0\Microsoft.Azure.Management.ManagementGroups.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.7.0\Microsoft.Extensions.Caching.Abstractions.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.7.0\Microsoft.Extensions.Caching.Abstractions.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.7.0\Microsoft.Extensions.Caching.Memory.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.7.0\Microsoft.Extensions.Caching.Memory.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\.vscode\extensions\ms-vscode.powershell-2023.5.0\modules\PowerShellEditorServices\bin\Common\Microsoft.Extensions.DependencyInj
ection.Abstractions.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\.vscode\extensions\ms-vscode.powershell-2023.5.0\modules\PowerShellEditorServices\bin\Common\Microsoft.Extensions.DependencyInj
ection.Abstractions.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\.vscode\extensions\ms-vscode.powershell-2023.5.0\modules\PowerShellEditorServices\bin\Common\Microsoft.Extensions.Options.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\.vscode\extensions\ms-vscode.powershell-2023.5.0\modules\PowerShellEditorServices\bin\Common\Microsoft.Extensions.Options.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\.vscode\extensions\ms-vscode.powershell-2023.5.0\modules\PowerShellEditorServices\bin\Common\Microsoft.Extensions.Primitives.dl
l'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\.vscode\extensions\ms-vscode.powershell-2023.5.0\modules\PowerShellEditorServices\bin\Common\Microsoft.Extensions.Primitives.dl
l'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\.vscode\extensions\ms-vscode.powershell-2023.5.0\modules\PowerShellEditorServices\bin\Common\System.Runtime.CompilerServices.Un
safe.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\.vscode\extensions\ms-vscode.powershell-2023.5.0\modules\PowerShellEditorServices\bin\Common\System.Runtime.CompilerServices.Un
safe.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.7.0\MSGraph.Autorest\bin\Az.MSGraph.private.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.7.0\MSGraph.Autorest\bin\Az.MSGraph.private.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.7.0\Authorization.Autorest\bin\Az.Authorization.private.dll'.
VERBOSE: Loading 'Assembly' from path
'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.7.0\Authorization.Autorest\bin\Az.Authorization.private.dll'.
VERBOSE: Loading 'FormatsToProcess' from path
'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.7.0\Resources.format.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path
'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.7.0\ResourceManager.format.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path
'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.7.0\ResourceManager.generated.format.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path
'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.7.0\Tags.format.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path
'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.7.0\MSGraph.Autorest\Az.MSGraph.format.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path
'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.7.0\Authorization.Autorest\Az.Authorization.format.ps1xml'.
VERBOSE: Loading module from path
'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.7.0\MSGraph.Autorest\Az.MSGraph.psm1'.
Loaded Module 'Az.Accounts'
Register-AzModule : The type initializer for 'Microsoft.Azure.Commands.Common.AzModule' threw an exception.
At C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.7.0\MSGraph.Autorest\Az.MSGraph.psm1:49 char:13
+ $VTable = Register-AzModule
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Register-AzModule], TypeInitializationException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Common.RegisterAzModule
Import-Module : The module to process
'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.7.0\MSGraph.Autorest\Az.MSGraph.psm1', listed in field
'NestedModules' of module manifest 'C:\Users\ORB\AppData\Local\Microsoft\PowerShell\Modules\Az.Resources\6.7.0\Az.Resources.psd1' was not
processed because no valid module was found in any module directory.
At line:1 char:1
+ Import-Module -Name 'Az.Resources' -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (Az.Resources:String) [Import-Module], PSInvalidOperationException
+ FullyQualifiedErrorId : Modules_ModuleFileNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
PS>
Seems like a different error than previously.
Not for vscode-powershell + Windows PowerShell 5.1 x64 at least. Got following error when trying to import Az.Monitor after having imported Az.Accounts v2.12.3.
PS > Resolve-AzError Resolve-AzError : Method 'get_SerializationSettings' in type 'Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient' from assembly 'Microsoft.Azure.PowerShell.Clients.ResourceManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not have an implementation. At line:1 char:1 + Resolve-AzError + ~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Resolve-AzError], TypeLoadException + FullyQualifiedErrorId : System.TypeLoadException,Microsoft.Azure.Commands.Profile.Errors.ResolveError PS >
Tried to import Az.Resources with verbose enabled.
Click to expand Seems like a different error than previously.
Yeah, I also get that error now. At least something is changing :(