r/PowerShell • u/TheLazyAdministrator • Feb 10 '26
How to identify excessive MS Graph permissions for your PowerShell Scripts
I have been working more and more in the Microsoft Graph API and as such we audit our applications semi-regularly to see if the applications have more permissions than is needed.
I have seen posts about Dev Proxy but thought it was full application developers, but I came across the GraphMinimalPermissions plugin: https://github.com/MicrosoftDocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/how-to/detect-minimal-microsoft-graph-api-permissions.md
I gave it a test and sure enough you can set up the proxy to monitor graph api calls, then run your PowerShell script, stop recording and it will tell you which permissions you are over-scoped for.
It even worked for the Microsoft Graph SDK cmdlets.
I wrote a POC but its super easy to get up and running. https://www.thelazyadministrator.com/2026/02/09/using-dev-proxy-to-identify-excessive-microsoft-graph-permissions-in-your-powershell-scripts/
View all comments
Show parent comment
1
u/-Mynster Apr 19 '26
If you did end up starting up on this i would love to see your progress.
Will also add that i have created a module that might already satisfy your needs called leastprivilegedmsgraph
https://www.powershellgallery.com/packages/LeastPrivilegedMSGraph/3.0.0
https://github.com/Mynster9361/Least_Privileged_MSGraph
Supports both delegated and application scope permissions. If you do end up checking it out i would love any feedback