创建 deviceManagementConfigurationPolicyCreate deviceManagementConfigurationPolicy
命名空间:microsoft.graphNamespace: microsoft.graph
重要说明: /Beta 版本下的 Microsoft Graph Api 可能会发生更改;不支持生产使用。Important: Microsoft Graph APIs under the /beta version are subject to change; production use is not supported.
注意: 适用于 Intune 的 Microsoft Graph API 需要适用于租户的 活动 Intune 许可证。Note: The Microsoft Graph API for Intune requires an active Intune license for the tenant.
创建新的 deviceManagementConfigurationPolicy 对象。Create a new deviceManagementConfigurationPolicy 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 | DeviceManagementConfiguration.ReadWrite.AllDeviceManagementConfiguration.ReadWrite.All |
HTTP 请求HTTP Request
POST /deviceManagement/configurationPolicies
请求标头Request headers
标头Header | 值Value |
---|---|
AuthorizationAuthorization | Bearer <token>。必需。Bearer <token> Required. |
接受Accept | application/jsonapplication/json |
请求正文Request body
在请求正文中,提供 deviceManagementConfigurationPolicy 对象的 JSON 表示形式。In the request body, supply a JSON representation for the deviceManagementConfigurationPolicy object.
下表显示创建 deviceManagementConfigurationPolicy 时所需的属性。The following table shows the properties that are required when you create the deviceManagementConfigurationPolicy.
属性Property | 类型Type | 说明Description |
---|---|---|
idid | StringString | 策略文档的键。Key of the policy document. 自动生成。Automatically generated. |
namename | StringString | 策略名称Policy name |
descriptiondescription | StringString | 策略说明Policy description |
平台platforms | deviceManagementConfigurationPlatformsdeviceManagementConfigurationPlatforms | 此策略的平台。Platforms for this policy. 可取值为:none 、macOS 、windows10X 、windows10 。Possible values are: none , macOS , windows10X , windows10 . |
技术technologies | deviceManagementConfigurationTechnologiesdeviceManagementConfigurationTechnologies | 适用于此策略的技术。Technologies for this policy. 可取值为:none 、mdm 、windows10XManagement 、configManager 。Possible values are: none , mdm , windows10XManagement , configManager . |
createdDateTimecreatedDateTime | DateTimeOffsetDateTimeOffset | 策略创建日期和时间。Policy creation date and time. 此属性是只读的。This property is read-only. |
lastModifiedDateTimelastModifiedDateTime | DateTimeOffsetDateTimeOffset | 策略上次修改日期和时间。Policy last modification date and time. 此属性是只读的。This property is read-only. |
settingCountsettingCount | Int32Int32 | 设置的数目。Number of settings. 此属性是只读的。This property is read-only. |
creationSourcecreationSource | StringString | 策略创建源Policy creation source |
roleScopeTagIdsroleScopeTagIds | String 集合String collection | 此实体实例的范围标记列表。List of Scope Tags for this Entity instance. |
isAssignedisAssigned | BooleanBoolean | 策略分配状态。Policy assignment status. 此属性是只读的。This property is read-only. |
响应Response
如果成功,此方法 201 Created
在响应正文中返回响应代码和 deviceManagementConfigurationPolicy 对象。If successful, this method returns a 201 Created
response code and a deviceManagementConfigurationPolicy object in the response body.
示例Example
请求Request
下面是一个请求示例。Here is an example of the request.
POST https://graph.microsoft.com/beta/deviceManagement/configurationPolicies
Content-type: application/json
Content-length: 346
{
"@odata.type": "#microsoft.graph.deviceManagementConfigurationPolicy",
"name": "Name value",
"description": "Description value",
"platforms": "macOS",
"technologies": "mdm",
"settingCount": 12,
"creationSource": "Creation Source value",
"roleScopeTagIds": [
"Role Scope Tag Ids value"
],
"isAssigned": 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 201 Created
Content-Type: application/json
Content-Length: 518
{
"@odata.type": "#microsoft.graph.deviceManagementConfigurationPolicy",
"id": "3ffd7cd0-7cd0-3ffd-d07c-fd3fd07cfd3f",
"name": "Name value",
"description": "Description value",
"platforms": "macOS",
"technologies": "mdm",
"createdDateTime": "2017-01-01T00:02:43.5775965-08:00",
"lastModifiedDateTime": "2017-01-01T00:00:35.1329464-08:00",
"settingCount": 12,
"creationSource": "Creation Source value",
"roleScopeTagIds": [
"Role Scope Tag Ids value"
],
"isAssigned": true
}