Microsoft Graph 将用户许可证分配给用户

Microsoft Graph assign user license to user

我正在尝试为 Office365 中的用户分配许可证,就像我在 powershell 中所做的那样

Set-MsolUserLicense -UserPrincipalName user@domain.com -AddLicenses licenseName

但不同之处在于,我正在尝试使用 Microsoft Graph 来完成。

我的 URL 如下:

https://graph.microsoft.com/beta/users('user@domain.com')/

我的json如下:

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

但作为回应,我收到以下消息:

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

问题是如何解决这个问题并实际设置许可证?或者你没有办法解决这个问题?

实际上我找到了解决方案here


自此问题发布后 API 已更新,以下文档应该有助于回答问题。

Assign License To User MS Graph Api V1.0 文档