Skip to content

vscode-powershell messes up Microsoft.Graph.Authentication #5053

@o-l-a-v

Description

@o-l-a-v

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all open and closed issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.

Summary


  • Windows 11 23H2 22631.4169 x64
  • PowerShell v7.4.5
  • VSCode v1.93.1 x64
  • vscode-powershell v2024.2.2
  • Microsoft.Graph.Authentication v2.23.0

Related issue:


I can't get the following to work from a vscode-powershell terminal, but it works in a barebone PowerShell v7.4.5 terminal, and the same PowerShell version through Windows Terminal.

Connect-MgGraph -ContextScope 'Process' -NoWelcome -UseDeviceCode -Scopes (
    'PrivilegedAccess.Read.AzureADGroup',
    'PrivilegedEligibilitySchedule.Read.AzureADGroup'
)

In VSCode this throws:

Connect-MgGraph: Method not found: 'System.Threading.Tasks.Task`1<Azure.Identity.AuthenticationRecord> Azure.Identity.DeviceCodeCredential.AuthenticateAsync(Azure.Core.TokenRequestContext, System.Threading.CancellationToken)'.

PowerShell Version

PS > $PSVersionTable

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

PS > $host

Name             : Visual Studio Code Host
Version          : 2024.2.2
InstanceId       : bfa40465-f731-49c5-8c6c-950b1358e6ae
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-SE
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

PS >

Visual Studio Code Version

PS > code --version

1.93.1
38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40
x64

PS >

Extension Version

PS > code --list-extensions --show-versions | Select-String powershell

ms-vscode.powershell@2024.2.2

PS >

Steps to Reproduce

# Run in VSCode with the VSCode-PowerShell extension in the "PowerShell Extension" terminal = Crash
Microsoft.Graph.Authentication\Connect-MgGraph -ContextScope 'Process' -NoWelcome -UseDeviceCode -Scopes (
    'PrivilegedAccess.Read.AzureADGroup',
    'PrivilegedEligibilitySchedule.Read.AzureADGroup'
)

Visuals

No response

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugA bug to squash.Needs: TriageMaintainer attention needed!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions