You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since Az.Accounts v2.12.2, VSCode + vscode-powershell + Windows PowerShell fails to load other Az.* modules, like Az.Resources.
Works if using vscode-powershell + PowerShell 7.3.
Works if using Windows PowerShell 5.1 terminal.
Works if using PowerShell ISE.
Automation Account in Azure has the same problem, the maintainers over at https://github.com/Azure/azure-powershell blamed Automation Account for it. I asked "what about vscode-powershell" but got no answers, so opening a ticket here too.
Install Az v10, which includes Az.Accounts v2.12.3 and Az.Resources v6.7.0.
Set vscode-powershell to use Windows PowerShell 5.1, confirm with $PSVersionTable.
Write the following: Import-Module -Name 'Az.Accounts','Az.Resources, it fails.
Visuals
No response
Logs
Output for import-module
PS >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
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\Authorization.Autorest\Az.Authorization.psm1:49 char:13+$VTable=Register-AzModule+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Register-AzModule], TypeInitializationException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Common.RegisterAzModule
PS >
Thanks @o-l-a-v we looked into this and unfortunately it looks like an issue with the GAC that we can't resolve, as you note the workaround is to use PowerShell 7
Prerequisites
Summary
Since
Az.Accounts
v2.12.2, VSCode + vscode-powershell + Windows PowerShell fails to load otherAz.*
modules, likeAz.Resources
.Automation Account in Azure has the same problem, the maintainers over at https://github.com/Azure/azure-powershell blamed Automation Account for it. I asked "what about vscode-powershell" but got no answers, so opening a ticket here too.
Here's the issue over at mentioned repo:
Az.Resources
v6.6.1 fails to import to Azure Automation Account Azure/azure-powershell#21647PowerShell Version
Windows PowerShell 5.1 x64
Visual Studio Code Version
1.78.2
Extension Version
v2023.5.0
Steps to Reproduce
Install Az v10, which includes
Az.Accounts
v2.12.3 andAz.Resources
v6.7.0.Set
vscode-powershell
to use Windows PowerShell 5.1, confirm with$PSVersionTable
.Write the following:
Import-Module -Name 'Az.Accounts','Az.Resources
, it fails.Visuals
No response
Logs
Output for import-module
Output for import-module -verbose
Output for resolve-azerror
The text was updated successfully, but these errors were encountered: