Skip to content

Latest commit

 

History

History
148 lines (114 loc) · 5.78 KB

File metadata and controls

148 lines (114 loc) · 5.78 KB
title Create or replace claimsPolicy
description Create a new custom claims policy object if it doesn't exist, or replace an existing one.
author rahul-nagraj
ms.localizationpriority medium
ms.subservice entra-id
doc_type apiPageType
ms.date 09/10/2024

Create or replace claimsPolicy

Namespace: microsoft.graph

[!INCLUDE beta-disclaimer]

Create a new customClaimsPolicy object if it doesn't exist, or replace an existing one.

[!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-customclaimspolicy-apis-write]

HTTP request

PUT /servicePrincipals/{servicePrincipalsId}/claimsPolicy

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, supply a JSON representation of the customClaimsPolicy object.

You can specify the following properties when creating a customClaimsPolicy.

Property Type Description
includeBasicClaimSet Boolean Determines whether the basic claim set is included in tokens affected by this policy. If set to true, all claims in the basic claim set are emitted in tokens affected by the policy. By default the basic claim set isn't in the tokens, unless they're explicitly configured in this policy. Optional.
includeApplicationIdInIssuer Boolean Indicates whether the application ID is added to the claim. It is relevant only for SAML2.0 and if a custom signing key is used. the default value is true. Optional.
audienceOverride String If specified, it overrides the content of the audience claim for WS-Federation and SAML2 protocols. A custom signing key must be used for audienceOverride to be applied, otherwise audienceOverride value is ignored. The value provided must be in the format of an absolute URI. Optional.
claims customClaimBase collection Defines which claims are present in the tokens affected by the policy, in addition to the basic claim and the core claim set. Optional.

Response

If successful, this method returns a 204 response code and a customClaimsPolicy object in the response body.

Examples

Request

The following example shows a request.

PUT https://graph.microsoft.com/beta/servicePrincipals/{servicePrincipalsId}/claimsPolicy
Content-Type: application/json

{
  "@odata.type": "#microsoft.graph.customClaimsPolicy",
  "includeBasicClaimSet": "Boolean",
  "includeApplicationIdInIssuer": "Boolean",
  "audienceOverride": "String",
  "claims": [
    {
      "@odata.type": "microsoft.graph.customClaim"
    }
  ]
}

[!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.

Note: The response object shown here might be shortened for readability.

HTTP/1.1 201 Created
Content-Type: application/json

{
  "@odata.type": "#microsoft.graph.customClaimsPolicy",
  "id": "f914f36d-167e-3fa7-cfa2-355cc5a36689",
  "includeBasicClaimSet": "Boolean",
  "includeApplicationIdInIssuer": "Boolean",
  "audienceOverride": "String",
  "claims": [
    {
      "@odata.type": "microsoft.graph.customClaim"
    }
  ]
}