Add sponsor
Namespace: microsoft.graph
Assign a user a sponsor. Sponsors are users and groups that are responsible for this guest user's privileges in the tenant and for keeping the guest user's information and access up to date.
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type | Least privileged permissions | Higher privileged permissions |
---|---|---|
Delegated (work or school account) | User.ReadWrite.All | Directory.ReadWrite.All |
Delegated (personal Microsoft account) | Not supported. | Not supported. |
Application | User.ReadWrite.All | Directory.ReadWrite.All |
Viktigt
In delegated scenarios with work or school accounts, the signed-in user must be assigned a supported Microsoft Entra role or a custom role with the microsoft.directory/users/sponsors/update
role permission. The following least privileged roles are supported for this operation:
- Directory Writers
- User Administrator
POST /users/{id}/sponsors/$ref
Name | Description |
---|---|
Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
Content-Type | application/json. Required. |
In the request body, supply a JSON object and pass an @odata.id
parameter with the read URL of the user or group object to be added.
If successful, this method returns 204 No Content
response code. It doesn't return anything in the response body.
The following example shows a request. The request body is a JSON object with an @odata.id
parameter and the read URL for the user object to be assigned as a sponsor.
POST https://graph.microsoft.com/v1.0/users/d8ab5060-f636-4cff-ae97-d4687f5c83f3/sponsors/$ref
Content-Type: application/json
{
"@odata.id": "https://graph.microsoft.com/v1.0/users/{user-id}"
}
The following example shows the response.
HTTP/1.1 204 No Content
The following example shows a request. The request body is a JSON object with an @odata.id
parameter and the read URL for the group object to be assigned as a sponsor.
POST https://graph.microsoft.com/v1.0/users/d8ab5060-f636-4cff-ae97-d4687f5c83f3/sponsors/$ref
Content-Type: application/json
{
"@odata.id": "https://graph.microsoft.com/v1.0/groups/{group-id}"
}
The following example shows the response.
HTTP/1.1 204 No Content