I recently hit upon an annoying problem when using VS Code and wanted to share with you how I worked around it.
I was trying to run some powershell commands against Azure Active Directory using the AzureAD Powershell module to query and correlate some identities and this was the first time I had done so for a long time. It was also the first time I had done so from the powershell integrated terminal in VS code.
Instructions to download and install the module are available on the Powershell Gallery.
The very first thing you need to do is to authenticate against your AAD Tenant.
In my case the default AAD tenant would suffice, so the command is simple enough:
What should happen, and you’d see this if you issued the command from a powershell.exe shell, is that you get a microsoft login dialog like so:
However, nothing displays, and it looks to all intents and purposes like the terminal has hung. I can’t break out of the command by pressing
c as you might expect, though killing the terminal works (by clicking on the trash can icon beside the terminal on the right hand side).
These are the dialogs you’re looking for!
After a few attempts decided I’d do some research and as I switched to my browser using
tab, I noticed a few login dialogs that didnt have their own icon, didn’t show up on the taskbar, didn’t have focus but were clearly the missing login dialogs.
Screenshot below demonstrates this using the
tab switching process, so that I could screenshot it.
I was able to end task them and away they went.
Knowing this, you just need to switch window to the hidden login dialog (using
tab) after you issue the
Connect-AzureAD command then login and when authentication is successfully completed, your terminal will return to the prompt with confirmation of the AAD tenant you are connected to.
Deciding that moaning about it wouldn’t fix it, I raised it as a bug on the VSCode GitHub Repo.
7 or so hours later, it was closed as a duplicate of this issue which has been open since 29th January 2018.
This also details other use cases where the same behaviour is experienced such as opening a link (
Start-Process "http://www.microsoft.com/") from PowerShell in the integrated terminal, piping an object to
Out-GridView, and any cmdlet that spawns a Windows Form or any form of GUI.
So, no fix is yet forthcoming, but do bear in mind the workaround I’ve mentioned and of course feel free to raise your own issues or comment on the issue mentioned in hopes of it gaining more focus with Microsoft for a fix
As ever, thanks for reading and feel free to leave comments down below!