Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use latest Az module in integrated PowerShell in VSCode #23350

Closed
hendersonandrade opened this issue Nov 10, 2023 · 2 comments
Closed
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported needs-triage This is a new issue that needs to be triaged to the appropriate team.

Comments

@hendersonandrade
Copy link

Description

Using Az module in latest version 10.4.1, I am unable to use any cmdlets in VS Code PowerShell integrated console. The output error is:

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

Connect-AzAccount:

  • CategoryInfo : NotSpecified: (:) [Connect-AzAccount], TypeLoadException
  • FullyQualifiedErrorId : System.TypeLoadException,Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand

image

Visual Studio Code Version:

1.83.1
f1b07bd25dfad64b0167beb15359ae573aecd2cc
x64

PowerShell Extension Version:

ms-vscode.powershell@2023.9.5

Issue script & Debug output

DEBUG: Initializing ConditionalAssemblyContext. PSEdition is [Desktop]. PSVersion is [5.1.19041.3570].
DEBUG: Initializing ConditionalAssemblyProvider. AssemblyRootPath is [C:\Users\hdandra\Documents\WindowsPowerShell\Modules\Az.Accounts\2.13.1\StartupScripts\..\lib].
Connect-AzAccount : 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
+ Connect-AzAccount
+ ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Connect-AzAccount], TypeLoadException
    + FullyQualifiedErrorId : System.TypeLoadException,Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand

Environment data

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

Module versions

ModuleType Version    Name                                ExportedCommands                                                                                                                              
---------- -------    ----                                ----------------                                                                                                                              
Script     2.13.1     Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault...}                                                                      
Script     4.6.0      Az.Monitor                          {Add-AzLogProfile, Add-AzMetricAlertRule, Add-AzMetricAlertRuleV2, Add-AzWebtestAlertRule...}

Error output

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 | clip
+ ~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Resolve-AzError], TypeLoadException
    + FullyQualifiedErrorId : System.TypeLoadException,Microsoft.Azure.Commands.Profile.Errors.ResolveError
@hendersonandrade hendersonandrade added bug This issue requires a change to an existing behavior in the product in order to be resolved. needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Nov 10, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported needs-triage This is a new issue that needs to be triaged to the appropriate team. and removed needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Nov 10, 2023
@hendersonandrade
Copy link
Author

the same issue was opened and have more information in comments in VS Code PowerShell extension project site:

PowerShell/vscode-powershell#4808

@isra-fel
Copy link
Member

Thanks for the feedback!
This is duplicate with #21647 which covered the assembly conflict issue that affected both Azure Automation and VSCode embedded PowerShell terminal. That issue also tracked by us internally. I'm going to close this issue.
As a workaround, I suggest installing PowerShell 7 and use it as your PowerShell terminal. The one that comes with the PowerShell extension has some preloaded modules such as PSScriptAnalyzer. We are having trouble resolving the conflict between it and Az.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported needs-triage This is a new issue that needs to be triaged to the appropriate team.
Projects
None yet
Development

No branches or pull requests

2 participants