Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should previous scopes show in new session started with Connect-MgGraph? #587

Closed
MatthewJDavis opened this issue Mar 17, 2021 · 3 comments
Closed
Assignees

Comments

@MatthewJDavis
Copy link

MatthewJDavis commented Mar 17, 2021

Hello,

I had previously connected to the graph with extra scopes.
I disconnected from the graph the reconnected with just "User.Read" permissions but (Get-MgContext).Scopes returns my previous scopes and I could still get data with Get-MgGroup, is this expected behaviour?

Disconnect-MgGraph
Connect-MgGraph -Scopes "User.Read" -ForceRefresh
(Get-MgContext).Scopes

Example:

image

Please let me know if you need any more information.

Thanks!

PS / Graph info:

Microsoft.Graph version: 1.4.2

PSVersion 7.1.3
PSEdition Core
GitCommitId 7.1.3
OS Microsoft Windows 10.0.19042
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
AB#8636

@ghost ghost added the ToTriage label Mar 17, 2021
@peombwa
Copy link
Member

peombwa commented Mar 17, 2021

@MatthewJDavis This is by design. When we make a call to /token to get an access token, AAD will still add all the previously consented permissions into the token.

@peombwa peombwa added question and removed ToTriage labels Mar 17, 2021
@peombwa peombwa self-assigned this Mar 17, 2021
@MatthewJDavis
Copy link
Author

Hi @peombwa,

Thanks for the information!

@o-l-a-v
Copy link

o-l-a-v commented Jan 9, 2024

@peombwa: This is a footgun. I've always thought -Scope sets what scopes/permissions I want for current session. If I don't plan on doing writes I chose read only scopes.

I see now that documentation says "An array of delegated permissions to consent to.".

Still. It's dangerous when users of the Microsoft.Graph module easily can think they can be totally safe from goofups when connected with -Scopes 'Directory.Read.All', but behind the scenes, without knowing it, they have all previously consented scopes too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants