SOLVED

Problems launching browser as admin

Brass Contributor

When I run PowerShell 7.4.3 as admin, there are issues when a browser should be launched but doesn’t behave appropriately. For example:

 

  1. When I get help and select a related link for online information, the familiar Windows popup asks which app to use. I select Edge and click to use Always. The next time I click a link, I’m asked again to select the app. I’ve tried with Edge and Chrome, and neither stick.
  2. When I run Connect-MSGraph -Scopes “User.Read.All”, “Group.ReadWrite.All” which requires web authentication, a browser never launches. The terminal hangs, and I have to Ctrl-C out of it. Other similar commands that require web authentication fail the same way, i.e., no browser is launched.
  3. When I run Connect-MSGraph -Scopes “User.Read.All”, “Group.ReadWrite.All” -UseDeviceAuthentication I get a link to open a page for the code, similar to #1 above. I get the same Windows popup, select Edge, and continue. There are other steps, but the connection is made, and the command succeeds. The next time I use the command, I’m asked again to select the app, etc.

I’ve tried this with the same results in multiple Windows PowerShell terminals and the VS Code PowerShell Extension integrated console. All have problems with PowerShell 7, but not PowerShell 5 (did not use MSGraph here). I don’t have the same problems as a standard user. I'm running in a MS 365 GCC environment, but I couldn't find any known GCC issues.

 

I’d very much appreciate some pointers on this. I’m a long-time hacker but still relatively new to Powershell.

3 Replies
Do you run it with a different account, a local or domain account? Do other settings you make in that session stick? There could be a remove profile policy on logoff so that the setting does not stick. Can you log in to your computer using the admin account, configure the default browser, and log off? Then log in using your regular account, do a run as with the admin account, and check again.
best response confirmed by KenStewart2750 (Brass Contributor)
Solution
This appears to have been resolved by authorizing Microsoft Graph Command Line Tools under MS 365 Entra Enterprise Applications. Why everything worked previously for standard user accounts but not for admins is still a mystery.
Thanks very much for your reply, Harm. I appreciate your helpful suggestions.

I replied to my original post with what appears to be a resolution, though some mystery remains.
1 best response

Accepted Solutions
best response confirmed by KenStewart2750 (Brass Contributor)
Solution
This appears to have been resolved by authorizing Microsoft Graph Command Line Tools under MS 365 Entra Enterprise Applications. Why everything worked previously for standard user accounts but not for admins is still a mystery.

View solution in original post