msgraph-sdk-powershell
msgraph-sdk-powershell copied to clipboard
Find-MgGraphCommand sorts required permissions alphabetically, not least privilege
Describe the bug For a solution I am working on, I am using the Graph via the PowerShell Graph modules. In order to determine the required permissions, I am trying the Find-MgGraphCommand cmdlet to find the most restrictive permissions. Unfortunately, that cmdlet has the issue that permissions are not ordered based on permission level, but it looks like they are sorted alphabetically (or at least partially). That makes the cmdlet much less useful.
To Reproduce Steps to reproduce the behavior:
- Run
(Find-MgGraphCommand -Command Get-MgOrganization)[0].Permissions. This command returns a list that is sorted alphabetically:
In the documentation, the list is ordered based on least privilege: Get organization
Expected behavior The expected behavior is that the sorting is based on least to most privileged, which makes much more sense.
Debug Output
Run the problematic command with
-Debugand paste the resulting debug stream below. ⚠ ATTENTION: Be sure to remove any sensitive information that may be in the logs.
Module Version 2.14.1
Environment Data Name Value
PSVersion 5.1.22621.2506 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.22621.2506 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.