I created an Azure AD Application added user_impersonation permission and generated access token using the https://management.azure.com/.default
scope
https://login.microsoftonline.com/XX/oauth2/v2.0/token
client_id:
client_secret:
scope:https://management.azure.com/.default
grant_type:client_credentials
I am referring to this Microsoft document to delete Azure resource by mentioning its ID
Resources - Delete By Id - REST API (Azure Resource Management) | Microsoft Learn
But it threw me the error
Status Code(403): 'Forbidden', Response from server: '{"error":{"code":"AuthorizationFailed","message":"The client ' ' with object id 'XXXX ' does not have authorization to perform action over scope or the scope is invalid. If access was recently granted, please refresh your credentials."}}'
I am Global Admin and granted required permissions too what else am I missing?