This issue seems like a bug or an undocumented limitation within Microsoft Graph API. There are occasionally scopes that may cause issues when trying to add as a delegated permission.
You might want to try a few things:
- Try to add the
RoleManagementPolicy.Read.AzureADGroup
scope separately after you've added all other scopes. - Try to add the
RoleManagementPolicy.Read.AzureADGroup
scope first before adding the other scopes. - Try to debug your script by adding one scope at a time to see if there are other scopes that cause this issue.
Also, please make sure that the account you're using to assign these permissions has the necessary rights to do so. In particular, it should have one of the following roles: Global Administrator, Privileged Role Administrator, Application Administrator, or Cloud Application Administrator. Here is the documentation on Permission and consent in the Microsoft identity platform. Another possibility is for this issue could be that the highlighted delegated permission "RoleManagementPolicy.Read.AzureADGroup" requires admin consent, which means that it cannot be granted by individual users and must be granted by an administrator. If the user running the PowerShell script does not have the necessary permissions to grant admin consent, then the script may fail to add this delegated permission to the list of required delegated permissions.
To resolve this issue, you may want to check if the user running the PowerShell script has the necessary permissions to grant admin consent for the highlighted delegated permission. If not, you may need to grant the user the necessary permissions or have an administrator grant admin consent for the delegated permission.