Service Principal does have Application.ReadWrite.OwnedBy
API permission but it can’t PATCH using the AZ REST commands.
It can LIST/ GET using AZ REST command.
az rest --method PATCH --uri "https://graph.microsoft.com/v1.0/applications/{OBJECT_ID}" --headers 'Content-Type=application/json' --body "{web:{redirectUris:['https://URL']}}"
Error:
Forbidden(
{
"error": {
"code":"Authorization_RequestDenied",
"message":"Insufficient privileges to complete the operation.",
"innerError": {
"date":"2022-10-13T06:10:41",
"request-id":"...",
"client-request-id":"...."
}
}
})
Any idea why it says forbidden?
2
Answers
As per the error you mentioned it seems to be delegated permission issue by the admin has to give permission to do that operation. Please check the same on Azure portal in API permission under App Registration
I tried reproduce in my environment got below results:
I have an Application with name
testvenkat
and added "Application.ReadWrite.OwnedBy
" api permission and alsogranted admin consent
permission which is shown below:Now I tried the same commands:
Console:
I used the
GET
method to see myWeb-redirectUrl
to make sure whether it is updated or not.Console:
Portal:
Please check the points
owner
" ."Application.ReadWrite.OwnedBy"
has application type in microsoft graph api.Reference:
Microsoft Graph permissions reference – Microsoft Graph | Microsoft Learn