Andrew
Andrew

Reputation: 47

Microsoft Graph assign user license to user

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?

Upvotes: 1

Views: 3584

Answers (2)

Andrew
Andrew

Reputation: 47

Actually I found the solution here


Upvotes: 1

Itanex
Itanex

Reputation: 1714

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

Upvotes: 0

Related Questions