| title | Assign appliesTo |
|---|---|
| description | Assign a policy to application or service principal object. |
| ms.localizationpriority | medium |
| author | aricrowe57 |
| ms.subservice | entra-sign-in |
| doc_type | apiPageType |
| ms.date | 07/29/2024 |
Namespace: microsoft.graph
[!INCLUDE beta-disclaimer]
Assign an appManagementPolicy policy object to an application or service principal object. The application or service principal adopts this policy over the tenant-wide tenantAppManagementPolicy setting. Only one policy object can be assigned to an application or service principal.
[!INCLUDE national-cloud-support]
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.
[!INCLUDE permissions-table]
[!INCLUDE rbac-app-auth-method-custom-policy-api-update]
POST /applications/{id}/appManagementPolicies/$ref| Name | Description |
|---|---|
| Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
| Content-Type | application/json. Required. |
In the request body, provide a reference to a single policy object from the appManagementPolicies collection.
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 to assign an appManagementPolicy to an application.
POST https://graph.microsoft.com/beta/applications/{id}/appManagementPolicies/$ref
Content-type: application/json
{
"@odata.id":"https://graph.microsoft.com/beta/policies/appManagementPolicies/{id}"
}[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
The following example shows the response.
HTTP/1.1 204 No ContentThe following example shows a request to assign an appManagementPolicy to a service principal.
POST https://graph.microsoft.com/beta/servicePrincipals/{id}/appManagementPolicies/$ref
{
"@odata.id":"https://graph.microsoft.com/beta/policies/appManagementPolicies/{id}"
}[!INCLUDE snippet-not-available] [!INCLUDE sdk-documentation]
[!INCLUDE snippet-not-available] [!INCLUDE sdk-documentation]
[!INCLUDE snippet-not-available] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE snippet-not-available] [!INCLUDE sdk-documentation]
[!INCLUDE snippet-not-available] [!INCLUDE sdk-documentation]
[!INCLUDE snippet-not-available] [!INCLUDE sdk-documentation]
The following example shows the response.
HTTP/1.1 204 No Content