I'm trying to use the Microsoft Graph API with App Authentication to assign an Office365 License to a newly created user. My App has the App permissions "Directory.Read.All" and "User.ReadWrite.All". I can create (POST /users) and delete (DELETE /users/$id) users successfully and I'm able to get the list of subscriptions (GET /subscribedSkus). But if I try to assign a license, I get an 403 response with:
https://graph.microsoft.com/v1.0/users/$upn/assignLicense
{
"error": {
"code": "Authorization_RequestDenied",
"message": "Insufficient privileges to complete the operation.",
"innerError": {
"request-id": "...",
"date": "..."
}
}
However according to the Graph API documentation the app permission "User.ReadWrite.All" should be sufficent. My request body looks as follows:
{
"addLicenses": [
{
"disabledPlans": [],
"skuId": "..."
}
],
"removeLicenses": []
}
Any idea why "User.ReadWrite.All" permissons are not sufficent, despite that the Graph API doc says otherwise?