Delegating App Registration Admin Consent permissions in Azure AD (an example for Sites.Selected)

I had posted about this previously… today I wanted to send a bunch of cmdlets to my colleagues to allow admin consenting of the Sites.Selected (both Graph API and SharePoint API) permission to a custom role. Here’s the PowerShell code to do that, based on what I posted previously.

Since the previous post I’ve fumbled my way to being more knowledgeable about Azure AD so there’s some minor differences in the code to what I posted then. Less hard-coding of ids etc. That post still has all the background info on what I am doing above so be sure to read that if the above makes no sense.