After compromising an app service, we can request access tokens for the managed identity. If the app service contains environment variables IDENTITY_HEADER and IDENTITY_ENDPOINT, it has a managed identity.
We can use the access token and client ID from above with Az PowerShell. But Az PowerShell’s Get- AzRoleAssignment would not show us the permissions for the current token. It would show role assignments only to ObjectIDs (no way to get the ObjectID of the Manged Identity token that we have).
Let's use the token with Azure REST API.
We would need the subscription ID, use the code below to request it: