Update Policy

Update properties in a preexisting policy.

Prerequisites

One of the following scopes is required to execute this API: Directory.AccessAsUser.All

HTTP request

PATCH /policies/{id}

Request headers

Name Type Description
Authorization string Bearer . Required.
Content-Type application/json Nature of the data in the body of an entity. Required.

Request body

In the request body, provide a JSON object with the parameters that need to be updated. The following table shows the possible parameters.

Parameter Type Description
definition String The stringified version of the policy object.
displayName String A custom name for the policy.
isOrganizationDefault Boolean Specifies if this policy is applied by default.
type String Specifies the type of policy. Currently must be "TokenLifetimePolicy"

Response

If successful, this method returns 204, No Content response code. If unsuccessful, a 4xx error will be returned with specific details.

Example

The following example updates the definition of the token lifetime policy and sets it as the organization default.

Request

Here is an example of the request.

PATCH https://graph.microsoft.com/beta/policies/{id}
Content-Type: application/json
{
    "definition":["{\"TokenLifetimePolicy\":{\"Version\":1,\"AccessTokenLifetime\":\"8:00:00\",\"MaxInactiveTime\":\"20:00:00\",}}"],
    "isOrganizationDefault":true
}
Response

Here is an example of the response. Note: The response object shown here may be truncated for brevity. All of the properties will be returned from an actual call.

HTTP/1.1 204 No Content