更新 macOSCompliancePolicyUpdate macOSCompliancePolicy

命名空间:microsoft.graphNamespace: microsoft.graph

注意: 适用于 Intune 的 Microsoft Graph API 需要适用于租户的活动 Intune 许可证Note: The Microsoft Graph API for Intune requires an active Intune license for the tenant.

更新 macOSCompliancePolicy 对象的属性。Update the properties of a macOSCompliancePolicy object.

先决条件Prerequisites

要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.

权限类型Permission type 权限(从最高特权到最低特权)Permissions (from most to least privileged)
委派(工作或学校帐户)Delegated (work or school account) DeviceManagementConfiguration.ReadWrite.AllDeviceManagementConfiguration.ReadWrite.All
委派(个人 Microsoft 帐户)Delegated (personal Microsoft account) 不支持。Not supported.
应用程序Application 不支持。Not supported.

HTTP 请求HTTP Request

PATCH /deviceManagement/deviceCompliancePolicies/{deviceCompliancePolicyId}

请求标头Request headers

标头Header Value
AuthorizationAuthorization Bearer <token>。必需。Bearer <token> Required.
接受Accept application/jsonapplication/json

请求正文Request body

在请求正文中,提供 macOSCompliancePolicy 对象的 JSON 表示形式。In the request body, supply a JSON representation for the macOSCompliancePolicy object.

下表显示创建 macOSCompliancePolicy 时所需的属性。The following table shows the properties that are required when you create the macOSCompliancePolicy.

属性Property 类型Type 说明Description
idid StringString 实体的键。Key of the entity. 继承自 deviceCompliancePolicyInherited from deviceCompliancePolicy
createdDateTimecreatedDateTime DateTimeOffsetDateTimeOffset 创建对象的日期/时间。DateTime the object was created. 继承自 deviceCompliancePolicyInherited from deviceCompliancePolicy
descriptiondescription StringString 管理员提供的设备配置的说明。Admin provided description of the Device Configuration. 继承自 deviceCompliancePolicyInherited from deviceCompliancePolicy
lastModifiedDateTimelastModifiedDateTime DateTimeOffsetDateTimeOffset 上次修改对象的日期/时间。DateTime the object was last modified. 继承自 deviceCompliancePolicyInherited from deviceCompliancePolicy
displayNamedisplayName StringString 管理员提供的设备配置的名称。Admin provided name of the device configuration. 继承自 deviceCompliancePolicyInherited from deviceCompliancePolicy
versionversion Int32Int32 设备配置的版本。Version of the device configuration. 继承自 deviceCompliancePolicyInherited from deviceCompliancePolicy
passwordRequiredpasswordRequired BooleanBoolean 是否需要密码。Whether or not to require a password.
passwordBlockSimplepasswordBlockSimple BooleanBoolean 指示是否阻止简单密码。Indicates whether or not to block simple passwords.
passwordExpirationDayspasswordExpirationDays Int32Int32 密码过期前的天数。Number of days before the password expires. 有效值为 1 至 65535Valid values 1 to 65535
passwordMinimumLengthpasswordMinimumLength Int32Int32 密码的最小长度。Minimum length of password. 有效值为 4 至 14Valid values 4 to 14
passwordMinutesOfInactivityBeforeLockpasswordMinutesOfInactivityBeforeLock Int32Int32 在需要密码之前不活动的分钟数。Minutes of inactivity before a password is required.
passwordPreviousPasswordBlockCountpasswordPreviousPasswordBlockCount Int32Int32 要阻止的以前密码的数量。Number of previous passwords to block. 有效值为 1 至 24Valid values 1 to 24
passwordMinimumCharacterSetCountpasswordMinimumCharacterSetCount Int32Int32 密码中必需的字符集数。The number of character sets required in the password.
passwordRequiredTypepasswordRequiredType requiredPasswordTyperequiredPasswordType 必需的密码类型。The required password type. 可取值为:deviceDefaultalphanumericnumericPossible values are: deviceDefault, alphanumeric, numeric.
osMinimumVersionosMinimumVersion StringString 最低 MacOS 版本。Minimum MacOS version.
osMaximumVersionosMaximumVersion StringString 最大 MacOS 版本。Maximum MacOS version.
systemIntegrityProtectionEnabledsystemIntegrityProtectionEnabled BooleanBoolean 要求设备已启用系统完整性保护。Require that devices have enabled system integrity protection.
deviceThreatProtectionEnableddeviceThreatProtectionEnabled BooleanBoolean 要求设备已启用设备威胁防护。Require that devices have enabled device threat protection.
deviceThreatProtectionRequiredSecurityLeveldeviceThreatProtectionRequiredSecurityLevel deviceThreatProtectionLeveldeviceThreatProtectionLevel 要求移动威胁防护最低风险级别来报告不符合情况。Require Mobile Threat Protection minimum risk level to report noncompliance. 可取值为:unavailablesecuredlowmediumhighnotSetPossible values are: unavailable, secured, low, medium, high, notSet.
storageRequireEncryptionstorageRequireEncryption BooleanBoolean 要求对 Mac OS 设备加密。Require encryption on Mac OS devices.
firewallEnabledfirewallEnabled BooleanBoolean 是否应启用防火墙。Whether the firewall should be enabled or not.
firewallBlockAllIncomingfirewallBlockAllIncoming BooleanBoolean 对应于 "阻止所有传入连接" 选项。Corresponds to the “Block all incoming connections” option.
firewallEnableStealthModefirewallEnableStealthMode BooleanBoolean 对应于 "启用隐形模式"。Corresponds to “Enable stealth mode.”

响应Response

如果成功,此方法会在响应正文中返回 200 OK 响应代码和更新的 macOSCompliancePolicy 对象。If successful, this method returns a 200 OK response code and an updated macOSCompliancePolicy object in the response body.

示例Example

请求Request

下面是一个请求示例。Here is an example of the request.

PATCH https://graph.microsoft.com/v1.0/deviceManagement/deviceCompliancePolicies/{deviceCompliancePolicyId}
Content-type: application/json
Content-length: 849

{
  "@odata.type": "#microsoft.graph.macOSCompliancePolicy",
  "description": "Description value",
  "displayName": "Display Name value",
  "version": 7,
  "passwordRequired": true,
  "passwordBlockSimple": true,
  "passwordExpirationDays": 6,
  "passwordMinimumLength": 5,
  "passwordMinutesOfInactivityBeforeLock": 5,
  "passwordPreviousPasswordBlockCount": 2,
  "passwordMinimumCharacterSetCount": 0,
  "passwordRequiredType": "alphanumeric",
  "osMinimumVersion": "Os Minimum Version value",
  "osMaximumVersion": "Os Maximum Version value",
  "systemIntegrityProtectionEnabled": true,
  "deviceThreatProtectionEnabled": true,
  "deviceThreatProtectionRequiredSecurityLevel": "secured",
  "storageRequireEncryption": true,
  "firewallEnabled": true,
  "firewallBlockAllIncoming": true,
  "firewallEnableStealthMode": 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 200 OK
Content-Type: application/json
Content-Length: 1021

{
  "@odata.type": "#microsoft.graph.macOSCompliancePolicy",
  "id": "ddbadff3-dff3-ddba-f3df-baddf3dfbadd",
  "createdDateTime": "2017-01-01T00:02:43.5775965-08:00",
  "description": "Description value",
  "lastModifiedDateTime": "2017-01-01T00:00:35.1329464-08:00",
  "displayName": "Display Name value",
  "version": 7,
  "passwordRequired": true,
  "passwordBlockSimple": true,
  "passwordExpirationDays": 6,
  "passwordMinimumLength": 5,
  "passwordMinutesOfInactivityBeforeLock": 5,
  "passwordPreviousPasswordBlockCount": 2,
  "passwordMinimumCharacterSetCount": 0,
  "passwordRequiredType": "alphanumeric",
  "osMinimumVersion": "Os Minimum Version value",
  "osMaximumVersion": "Os Maximum Version value",
  "systemIntegrityProtectionEnabled": true,
  "deviceThreatProtectionEnabled": true,
  "deviceThreatProtectionRequiredSecurityLevel": "secured",
  "storageRequireEncryption": true,
  "firewallEnabled": true,
  "firewallBlockAllIncoming": true,
  "firewallEnableStealthMode": true
}