Why does Connect-MgGraph use the default browser in PowerShell 7 instead of the built-in one?

0
0
Asked By TechyNinja42 On

I'm curious why the Connect-MgGraph command launches the default web browser when I'm using PowerShell 7. In PowerShell 5, it opens the built-in browser, which is much more convenient for me. I have multiple accounts for different tenants that I access occasionally, and I prefer not having them cluttering my main browser. I rely on the advancements and speed of PowerShell 7, but I'm wondering if there's a way to make it work within PowerShell 5 instead. Alternatively, is there a method to make Connect-MgGraph utilize the built-in PowerShell browser, instead of my system's default web browser?

3 Answers

Answered By BusyBeeDev On

What about using device code flow? That way, you can open any browser you want. You can check out the Microsoft Learn docs for it.

ConcernedUser99 -

But wouldn't the security implications be similar to using certificates or secrets? Just wondering if there's real added protection.

Answered By CleverCoder88 On

Unfortunately, it seems like you can't force Connect-MgGraph to use the built-in mini-browser with PowerShell 7. One useful tip, though, is to set up app registrations for authentication, which avoids the pop-up window altogether.

ScriptingSavant20 -

Exactly! Especially if you're working with multiple tenants. I've set up some app registrations for running M365 reporting scripts, and it's made things much smoother across both PowerShell 5.1 and 7.

CyberSecWhiz99 -

I get that approach, but it's a bit tricky if you're dealing with sensitive permissions. For the scripts I'm working on, I need to ensure each user has to authenticate through our domain admin with MFA each time.

Answered By JustAnotherDev On

You could just grab the URL from the default browser and paste it into your favorite browser. It's a simple workaround, although it might slow you down a bit.

QuickMind22 -

Good point! I hadn’t thought of that. It might take a little extra time, but it's worth a shot.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.