Skip to content

Latest commit

 

History

History
193 lines (134 loc) · 6.69 KB

File metadata and controls

193 lines (134 loc) · 6.69 KB
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

Assign appliesTo

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]

Permissions

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]

HTTP request

POST /applications/{id}/appManagementPolicies/$ref

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-Type application/json. Required.

Request body

In the request body, provide a reference to a single policy object from the appManagementPolicies collection.

Response

If successful, this method returns 204 No Content response code. It doesn't return anything in the response body.

Examples

Example 1: Assign an appManagementPolicy to an application object

Request

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]


Response

The following example shows the response.

HTTP/1.1 204 No Content

Example 2: Assign an appManagementPolicy to a service principal object

Request

The 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]


Response

The following example shows the response.

HTTP/1.1 204 No Content