Edit

resourcePolicyDefinition resource type

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.

Represents a versioned Rego policy definition that governs Microsoft Graph resource changes.

For policy structure, metadata, parameters, and examples, see Author policies with Rego.

The Rego package name supplies the definition's uniqueName and version, using the format graph.<uniqueName>["<semantic-version>"]. The semantic version has three numeric components: major.minor.patch. For example, package graph.require_application_name["1.0.0"] identifies version 1.0.0 of require_application_name.

The service extracts displayName from __metadata__.title, description from __metadata__.description, and category from __metadata__.category. It computes rule.appliesTo from __metadata__.selector. The selector must contain a supported, case-sensitive resourceName and a nonempty operations array. For example, the following declarations select application creation and update operations:

package graph.require_application_name["1.0.0"]

__metadata__ := {
  "title": "Require an application name",
  "description": "Require applications to have a display name",
  "category": "identityAndTenant",
  "selector": {
    "resourceName": "microsoft.graph.application",
    "operations": ["create", "updateOrUpsert"]
  }
}

Methods

Method Return type Description
List definitions resourcePolicyDefinition collection List customer-authored definitions.
List built-in definitions resourcePolicyDefinition collection List read-only Microsoft-authored definitions.
Create resourcePolicyDefinition Create a customer-authored definition.
Get resourcePolicyDefinition Read an active, built-in, or deleted definition.
Update None Update a customer-authored definition.
Upsert resourcePolicyDefinition Create a definition, or update it with no response body if it exists.
Delete None Delete an active definition.
Permanently delete None Permanently delete a definition.
Restore resourcePolicyDefinition Restore a deleted definition.
List previous versions resourcePolicyDefinitionVersion collection List an active customer-authored or built-in definition's previous versions.

Properties

Property Type Description
category policyCategory The functional category extracted from the Rego policy metadata. The default is notSpecified. Supports $filter (eq). Read-only. The possible values are: notSpecified, workloadIdentity, identityAndTenant, privilegedAccess, zeroTrust, agenticIdentity, networkAccess, unknownFutureValue.
createdDateTime DateTimeOffset The date and time the object was created, in ISO 8601 format and UTC. Read-only. Supports $filter (le, gt).
deletedDateTime DateTimeOffset The date and time the object was deleted, in ISO 8601 format and UTC. Null for an active object. Read-only.
description String The description extracted from the Rego policy metadata. Maximum length is 1,024 characters. Read-only.
displayName String The display name extracted from the Rego policy's __metadata__.title. Maximum length is 128 characters. Read-only.
lastModifiedDateTime DateTimeOffset The date and time the object was last modified, in ISO 8601 format and UTC. Read-only. Supports $filter (le, gt).
paramsSchema Json The JSON parameter schema extracted from the Rego policy's __metadata__. Assignment parameter values are validated against this schema. Supports $select. Read-only.
rule resourcePolicyRule The Rego policy and its computed applicability information.
uniqueName String The immutable unique name and primary key, matching the name in the Rego package. Required in a JSON create request; derived from the package name in a plain-text create request. Must start with an ASCII letter, contain only ASCII letters, digits, or underscores, and have at most 128 characters. The prefixes microsoft and ms (including msft) and the exact names utils and input are reserved, regardless of case. Hyphens and non-ASCII characters aren't allowed.
version String The three-part semantic version extracted from the Rego package name, such as 1.0.0 in package graph.require_application_name["1.0.0"]. Read-only.

Relationships

Relationship Type Description
assignments resourcePolicyAssignment collection The assignments for this definition. Read-only. Supports $expand.
previousVersions resourcePolicyDefinitionVersion collection The previous versions of an active customer-authored or built-in definition. Read-only. Supports $expand.

JSON representation

The following JSON representation shows the resource type.

{
  "@odata.type": "#microsoft.graph.resourcePolicyDefinition",
  "uniqueName": "String (identifier)",
  "createdDateTime": "String (timestamp)",
  "lastModifiedDateTime": "String (timestamp)",
  "displayName": "String",
  "description": "String",
  "category": "String",
  "version": "String",
  "deletedDateTime": "String (timestamp)",
  "rule": {
    "@odata.type": "microsoft.graph.resourcePolicyRule"
  },
  "paramsSchema": {
    "@odata.type": "microsoft.graph.Json"
  }
}