0
votes

I'm trying to assign license to user in Office365 like I would do with powershell

Set-MsolUserLicense -UserPrincipalName [email protected] -AddLicenses licenseName

But the difference is that I'm trying to do it with Microsoft Graph.

My URL is following:

https://graph.microsoft.com/beta/users('[email protected]')/

And my json is following:

    { "assignedLicenses": [
                            {
                                "skuId": "myID"
                            }
                      ]
}

But in response I'm getting following message:

{ "error": { "code": "Request_BadRequest", "message": "Property 'assignedLicenses' is read-only and cannot be set.", "innerError": { "request-id": "myID", "date": "2016-03-31T09:07:34" } } }

The question is how do I work around this issue and actually set license? Or there is no way yo work around this?

2

2 Answers

0
votes

As the API has been updated since this question has been posted the following document should help answer the question.

Assign License To User MS Graph Api V1.0 docs

0
votes

Actually I found the solution here