Create updatePolicy

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.

Create a new updatePolicy 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

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.

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

For an app to read or write all Windows update deployment settings with delegated permissions, the signed-in user must be assigned the Global Administrator, Intune Administrator, or Windows Update Deployment Administrator Microsoft Entra roles.

HTTP request

POST /admin/windows/updates/updatePolicies

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 updatePolicy object.

You can specify the following properties when you create an updatePolicy.

Property Type Description
audience microsoft.graph.windowsUpdates.deploymentAudience Specifies the audience to target.
complianceChanges microsoft.graph.windowsUpdates.complianceChange collection Compliance changes like content approvals which result in the automatic creation of deployments using the audience and deploymentSettings of the policy.
complianceChangeRules microsoft.graph.windowsUpdates.complianceChangeRule collection Rules for governing the automatic creation of compliance changes.
deploymentSettings microsoft.graph.windowsUpdates.deploymentSettings Settings for governing how to deploy content.

Response

If successful, this method returns a 201 Created response code and an microsoft.graph.windowsUpdates.updatePolicy object in the response body.

Examples

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/admin/windows/updates/updatePolicies
Content-Type: application/json
Content-length: 835

{
  "@odata.type": "#microsoft.graph.windowsUpdates.updatePolicy",
  "audience": {
    "id": "8c4eb1eb-d7a3-4633-8e2f-f926e82df08e"
  },
  "complianceChanges": [
    {
      "@odata.type": "#microsoft.graph.windowsUpdates.contentApproval"
    }
  ],
  "complianceChangeRules": [
    {
      "@odata.type": "#microsoft.graph.windowsUpdates.contentApprovalRule",
      "contentFilter": {
        "@odata.type": "#microsoft.graph.windowsUpdates.driverUpdateFilter"
      },
      "durationBeforeDeploymentStart": "P7D"
    }
  ],
  "deploymentSettings": {
    "@odata.type": "microsoft.graph.windowsUpdates.deploymentSettings",
    "schedule": {
      "gradualRollout": {
        "@odata.type": "#microsoft.graph.windowsUpdates.rateDrivenRolloutSettings",
        "durationBetweenOffers": "P1D",
        "devicePerOffer": 1000
      }
    }
  }
}

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.context": "https://graph.microsoft.com/beta/$metadata#admin/windows/updates/updatePolicies/$entity",
    "id": "1b35b81b-f839-4951-882a-1fbfc6446409",
    "createdDateTime": "String (timestamp)",
    "autoEnrollmentUpdateCategories": [],
    "complianceChangeRules": [
        {
            "@odata.type": "#microsoft.graph.windowsUpdates.contentApprovalRule",
            "createdDateTime": "String (timestamp)",
            "lastEvaluatedDateTime": "String (timestamp)",
            "lastModifiedDateTime": "String (timestamp)",
            "durationBeforeDeploymentStart": "P7D",
            "contentFilter": {
                "@odata.type": "#microsoft.graph.windowsUpdates.driverUpdateFilter"
            }
        }
    ],
    "deploymentSettings": {
        "monitoring": null,
        "contentApplicability": null,
        "userExperience": null,
        "expedite": null,
        "schedule": {
            "startDateTime": "String (timestamp)",
            "gradualRollout": {
                "@odata.type": "#microsoft.graph.windowsUpdates.rateDrivenRolloutSettings",
                "durationBetweenOffers": "P1D",
                "devicesPerOffer": 0
            }
        }
    }
}