简体   繁体   中英

Powershell AzureAD module in Visual Studio Code

I am trying to debug a powershell script in Visual Studio Code but when I try to execute connect-azuread I get this error message:

connect-azuread : The 'connect-azuread' command was found in the module 'AzureAD', but the module could not be loaded. For more information, run 'Import-Module AzureAD'.

When I try to do Import-Module AzureAD, I get this other error:

Import-Module : The current processor architecture is: X86. The module 'C:\\Program Files\\WindowsPowerShell\\Modules\\azuread\\2.0.2.4\\azuread.psd1' requires the following architecture: Amd64.

If I switch the terminal from PowerShell Integrated to powershell it works, but when I start debugging my code it goes back to the integrated one.

Any ideas how to fix this?

In the meantime it looks like I managed to fix this by updating the settings to this:

{
"powershell.powerShellExePath": 
    "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", "terminal.integrated.shell.windows": 
    "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", "terminal.explorerKind": "external"
}

The original version was below and it looks like the SysWow64 version is 32 bit

{
    "powershell.powerShellExePath": "C:\\WINDOWS\\SysWow64\\WindowsPowerShell\\v1.0\\powershell.exe",
    "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
}

从 VS 设置中的 powershell.powerShellDefaultVersion 设置中删除 (x86)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM