ערוך

שתף באמצעות


Update directorySetting

Namespace: microsoft.graph

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

Update the properties of a specific directory setting object.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

Permissions

The following tables show the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. 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) Directory.ReadWrite.All Not available.
Delegated (personal Microsoft account) Not supported. Not supported.
Application Directory.ReadWrite.All Not available.

The following permissions are required to update the "Consent Policy Settings" directorySetting object.

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) Policy.ReadWrite.Authorization Directory.ReadWrite.All
Delegated (personal Microsoft account) Not supported. Not supported.
Application Policy.ReadWrite.Authorization Directory.ReadWrite.All

Important

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 a supported role permission. The following least privileged roles are supported for this operation.

  • Read basic properties on setting templates and settings - Microsoft Entra Joined Device Local Administrator, Directory Readers, Global Reader
  • Manage all group/directory settings - Directory Writers
  • Manage global and local settings for groups; manage Group.Unified.Guest and Group.Unified settings - Groups Administrator
  • Update Password Rule Settings - Authentication Policy Administrator
  • Update settings, Read basic properties on setting templates and settings - User Administrator

HTTP request

Update a tenant-wide setting.

PATCH /settings/{directorySettingId}

Update a group-specific setting.

PATCH /groups/{groupId}/settings/{directorySettingId}

Optional request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.

Request body

In the request body, supply the values for relevant fields that should be updated.

Property Type Description
values settingValue collection The updated set of values. NOTE: You must supply the entire collection set. You cannot update a single set of values.

Response

If successful, this method returns a 204 No Content response code.

Example

Request

The following example shows a request.

PATCH https://graph.microsoft.com/beta/settings/3c105fc3-2254-4861-9e2d-d59e2126f3ef
Content-type: application/json

{
    "values": [
        {
            "name": "CustomBlockedWordsList",
            "value": "Contoso"
        }
    ]
}

Response

HTTP/1.1 204 No Content