DisConnect-MgGraph not resetting Scopes

Bridget Tompkin (Galliford Try) 41 Reputation points
2024-05-24T16:20:05.23+00:00

Please can you help. I am new to MgGraph in PowerShell

I have been playing around with different scopes. I now want to remove then, so that I get back to least privilege to deploy my powerhouse scipt.

I have restarted powershell

Issued

Disconnect-MgGraph (Which does diconnect, if there has been a connection)

Connect-MgGraph -Scopes "User.Read" (Which prompts me for a user and password)

Get-MgContext | Select Scopes

Here I am wanting to just see User.Read (along with other default scopes), but I am seeing all the scopes I have ever entered.

Is there an easy way of clearing this down.

PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,219 questions
0 comments No comments
{count} votes