Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Bicep resource definition
The policySetDefinitions resource type can be deployed with operations that target:
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.Authorization/policySetDefinitions resource, add the following Bicep to your template.
resource symbolicname 'Microsoft.Authorization/policySetDefinitions@2025-03-01' = {
scope: resourceSymbolicName or scope
name: 'string'
properties: {
description: 'string'
displayName: 'string'
metadata: any(...)
parameters: {
{customized property}: {
allowedValues: [
any(...)
]
defaultValue: any(...)
metadata: {
assignPermissions: bool
description: 'string'
displayName: 'string'
strongType: 'string'
}
schema: any(...)
type: 'string'
}
}
policyDefinitionGroups: [
{
additionalMetadataId: 'string'
category: 'string'
description: 'string'
displayName: 'string'
name: 'string'
}
]
policyDefinitions: [
{
definitionVersion: 'string'
groupNames: [
'string'
]
parameters: {
{customized property}: {
value: any(...)
}
}
policyDefinitionId: 'string'
policyDefinitionReferenceId: 'string'
}
]
policyType: 'string'
version: 'string'
versions: [
'string'
]
}
}
Property Values
Microsoft.Authorization/policySetDefinitions
| Name | Description | Value |
|---|---|---|
| name | The resource name | string Constraints: Pattern = ^[^<>*%&:\?.+/]*[^<>*%&:\?.+/ ]+$ (required) |
| properties | The policy set definition properties. | PolicySetDefinitionProperties |
| scope | Use when creating a resource at a scope that is different than the deployment scope. | Set this property to the symbolic name of a resource to apply the extension resource. |
ParameterDefinitions
| Name | Description | Value |
|---|
ParameterDefinitionsValue
| Name | Description | Value |
|---|---|---|
| allowedValues | The allowed values for the parameter. | any[] |
| defaultValue | The default value for the parameter if no value is provided. | any |
| metadata | General metadata for the parameter. | ParameterDefinitionsValueMetadata |
| schema | Provides validation of parameter inputs during assignment using a self-defined JSON schema. This property is only supported for object-type parameters and follows the Json.NET Schema 2019-09 implementation. You can learn more about using schemas at https://json-schema.org/ and test draft schemas at https://www.jsonschemavalidator.net/. | any |
| type | The data type of the parameter. | 'Array' 'Boolean' 'DateTime' 'Float' 'Integer' 'Object' 'String' |
ParameterDefinitionsValueMetadata
| Name | Description | Value |
|---|---|---|
| assignPermissions | Set to true to have Azure portal create role assignments on the resource ID or resource scope value of this parameter during policy assignment. This property is useful in case you wish to assign permissions outside the assignment scope. | bool |
| description | The description of the parameter. | string |
| displayName | The display name for the parameter. | string |
| strongType | Used when assigning the policy definition through the portal. Provides a context aware list of values for the user to choose from. | string |
ParameterValues
| Name | Description | Value |
|---|
ParameterValuesValue
| Name | Description | Value |
|---|---|---|
| value | The value of the parameter. | any |
PolicyDefinitionGroup
| Name | Description | Value |
|---|---|---|
| additionalMetadataId | A resource ID of a resource that contains additional metadata about the group. | string |
| category | The group's category. | string |
| description | The group's description. | string |
| displayName | The group's display name. | string |
| name | The name of the group. | string (required) |
PolicyDefinitionReference
| Name | Description | Value |
|---|---|---|
| definitionVersion | The version of the policy definition to use. | string |
| groupNames | The name of the groups that this policy definition reference belongs to. | string[] |
| parameters | The parameter values for the referenced policy rule. The keys are the parameter names. | ParameterValues |
| policyDefinitionId | The ID of the policy definition or policy set definition. | string (required) |
| policyDefinitionReferenceId | A unique id (within the policy set definition) for this policy definition reference. | string |
PolicySetDefinitionProperties
| Name | Description | Value |
|---|---|---|
| description | The policy set definition description. | string |
| displayName | The display name of the policy set definition. | string |
| metadata | The policy set definition metadata. Metadata is an open ended object and is typically a collection of key value pairs. | any |
| parameters | The policy set definition parameters that can be used in policy definition references. | ParameterDefinitions |
| policyDefinitionGroups | The metadata describing groups of policy definition references within the policy set definition. | PolicyDefinitionGroup[] |
| policyDefinitions | An array of policy definition references. | PolicyDefinitionReference[] (required) |
| policyType | The type of policy set definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. | 'BuiltIn' 'Custom' 'NotSpecified' 'Static' |
| version | The policy set definition version in #.#.# format. | string |
| versions | A list of available versions for this policy set definition. | string[] |
ARM template resource definition
The policySetDefinitions resource type can be deployed with operations that target:
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.Authorization/policySetDefinitions resource, add the following JSON to your template.
{
"type": "Microsoft.Authorization/policySetDefinitions",
"apiVersion": "2025-03-01",
"name": "string",
"properties": {
"description": "string",
"displayName": "string",
"metadata": {},
"parameters": {
"{customized property}": {
"allowedValues": [ {} ],
"defaultValue": {},
"metadata": {
"assignPermissions": "bool",
"description": "string",
"displayName": "string",
"strongType": "string"
},
"schema": {},
"type": "string"
}
},
"policyDefinitionGroups": [
{
"additionalMetadataId": "string",
"category": "string",
"description": "string",
"displayName": "string",
"name": "string"
}
],
"policyDefinitions": [
{
"definitionVersion": "string",
"groupNames": [ "string" ],
"parameters": {
"{customized property}": {
"value": {}
}
},
"policyDefinitionId": "string",
"policyDefinitionReferenceId": "string"
}
],
"policyType": "string",
"version": "string",
"versions": [ "string" ]
}
}
Property Values
Microsoft.Authorization/policySetDefinitions
| Name | Description | Value |
|---|---|---|
| apiVersion | The api version | '2025-03-01' |
| name | The resource name | string Constraints: Pattern = ^[^<>*%&:\?.+/]*[^<>*%&:\?.+/ ]+$ (required) |
| properties | The policy set definition properties. | PolicySetDefinitionProperties |
| type | The resource type | 'Microsoft.Authorization/policySetDefinitions' |
ParameterDefinitions
| Name | Description | Value |
|---|
ParameterDefinitionsValue
| Name | Description | Value |
|---|---|---|
| allowedValues | The allowed values for the parameter. | any[] |
| defaultValue | The default value for the parameter if no value is provided. | any |
| metadata | General metadata for the parameter. | ParameterDefinitionsValueMetadata |
| schema | Provides validation of parameter inputs during assignment using a self-defined JSON schema. This property is only supported for object-type parameters and follows the Json.NET Schema 2019-09 implementation. You can learn more about using schemas at https://json-schema.org/ and test draft schemas at https://www.jsonschemavalidator.net/. | any |
| type | The data type of the parameter. | 'Array' 'Boolean' 'DateTime' 'Float' 'Integer' 'Object' 'String' |
ParameterDefinitionsValueMetadata
| Name | Description | Value |
|---|---|---|
| assignPermissions | Set to true to have Azure portal create role assignments on the resource ID or resource scope value of this parameter during policy assignment. This property is useful in case you wish to assign permissions outside the assignment scope. | bool |
| description | The description of the parameter. | string |
| displayName | The display name for the parameter. | string |
| strongType | Used when assigning the policy definition through the portal. Provides a context aware list of values for the user to choose from. | string |
ParameterValues
| Name | Description | Value |
|---|
ParameterValuesValue
| Name | Description | Value |
|---|---|---|
| value | The value of the parameter. | any |
PolicyDefinitionGroup
| Name | Description | Value |
|---|---|---|
| additionalMetadataId | A resource ID of a resource that contains additional metadata about the group. | string |
| category | The group's category. | string |
| description | The group's description. | string |
| displayName | The group's display name. | string |
| name | The name of the group. | string (required) |
PolicyDefinitionReference
| Name | Description | Value |
|---|---|---|
| definitionVersion | The version of the policy definition to use. | string |
| groupNames | The name of the groups that this policy definition reference belongs to. | string[] |
| parameters | The parameter values for the referenced policy rule. The keys are the parameter names. | ParameterValues |
| policyDefinitionId | The ID of the policy definition or policy set definition. | string (required) |
| policyDefinitionReferenceId | A unique id (within the policy set definition) for this policy definition reference. | string |
PolicySetDefinitionProperties
| Name | Description | Value |
|---|---|---|
| description | The policy set definition description. | string |
| displayName | The display name of the policy set definition. | string |
| metadata | The policy set definition metadata. Metadata is an open ended object and is typically a collection of key value pairs. | any |
| parameters | The policy set definition parameters that can be used in policy definition references. | ParameterDefinitions |
| policyDefinitionGroups | The metadata describing groups of policy definition references within the policy set definition. | PolicyDefinitionGroup[] |
| policyDefinitions | An array of policy definition references. | PolicyDefinitionReference[] (required) |
| policyType | The type of policy set definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. | 'BuiltIn' 'Custom' 'NotSpecified' 'Static' |
| version | The policy set definition version in #.#.# format. | string |
| versions | A list of available versions for this policy set definition. | string[] |
Usage Examples
Terraform (AzAPI provider) resource definition
The policySetDefinitions resource type can be deployed with operations that target:
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.Authorization/policySetDefinitions resource, add the following Terraform to your template.
resource "azapi_resource" "symbolicname" {
type = "Microsoft.Authorization/policySetDefinitions@2025-03-01"
name = "string"
parent_id = "string"
body = {
properties = {
description = "string"
displayName = "string"
metadata = ?
parameters = {
{customized property} = {
allowedValues = [
?
]
defaultValue = ?
metadata = {
assignPermissions = bool
description = "string"
displayName = "string"
strongType = "string"
}
schema = ?
type = "string"
}
}
policyDefinitionGroups = [
{
additionalMetadataId = "string"
category = "string"
description = "string"
displayName = "string"
name = "string"
}
]
policyDefinitions = [
{
definitionVersion = "string"
groupNames = [
"string"
]
parameters = {
{customized property} = {
value = ?
}
}
policyDefinitionId = "string"
policyDefinitionReferenceId = "string"
}
]
policyType = "string"
version = "string"
versions = [
"string"
]
}
}
}
Property Values
Microsoft.Authorization/policySetDefinitions
| Name | Description | Value |
|---|---|---|
| name | The resource name | string Constraints: Pattern = ^[^<>*%&:\?.+/]*[^<>*%&:\?.+/ ]+$ (required) |
| parent_id | The ID of the resource to apply this extension resource to. | string (required) |
| properties | The policy set definition properties. | PolicySetDefinitionProperties |
| type | The resource type | "Microsoft.Authorization/policySetDefinitions@2025-03-01" |
ParameterDefinitions
| Name | Description | Value |
|---|
ParameterDefinitionsValue
| Name | Description | Value |
|---|---|---|
| allowedValues | The allowed values for the parameter. | any[] |
| defaultValue | The default value for the parameter if no value is provided. | any |
| metadata | General metadata for the parameter. | ParameterDefinitionsValueMetadata |
| schema | Provides validation of parameter inputs during assignment using a self-defined JSON schema. This property is only supported for object-type parameters and follows the Json.NET Schema 2019-09 implementation. You can learn more about using schemas at https://json-schema.org/ and test draft schemas at https://www.jsonschemavalidator.net/. | any |
| type | The data type of the parameter. | 'Array' 'Boolean' 'DateTime' 'Float' 'Integer' 'Object' 'String' |
ParameterDefinitionsValueMetadata
| Name | Description | Value |
|---|---|---|
| assignPermissions | Set to true to have Azure portal create role assignments on the resource ID or resource scope value of this parameter during policy assignment. This property is useful in case you wish to assign permissions outside the assignment scope. | bool |
| description | The description of the parameter. | string |
| displayName | The display name for the parameter. | string |
| strongType | Used when assigning the policy definition through the portal. Provides a context aware list of values for the user to choose from. | string |
ParameterValues
| Name | Description | Value |
|---|
ParameterValuesValue
| Name | Description | Value |
|---|---|---|
| value | The value of the parameter. | any |
PolicyDefinitionGroup
| Name | Description | Value |
|---|---|---|
| additionalMetadataId | A resource ID of a resource that contains additional metadata about the group. | string |
| category | The group's category. | string |
| description | The group's description. | string |
| displayName | The group's display name. | string |
| name | The name of the group. | string (required) |
PolicyDefinitionReference
| Name | Description | Value |
|---|---|---|
| definitionVersion | The version of the policy definition to use. | string |
| groupNames | The name of the groups that this policy definition reference belongs to. | string[] |
| parameters | The parameter values for the referenced policy rule. The keys are the parameter names. | ParameterValues |
| policyDefinitionId | The ID of the policy definition or policy set definition. | string (required) |
| policyDefinitionReferenceId | A unique id (within the policy set definition) for this policy definition reference. | string |
PolicySetDefinitionProperties
| Name | Description | Value |
|---|---|---|
| description | The policy set definition description. | string |
| displayName | The display name of the policy set definition. | string |
| metadata | The policy set definition metadata. Metadata is an open ended object and is typically a collection of key value pairs. | any |
| parameters | The policy set definition parameters that can be used in policy definition references. | ParameterDefinitions |
| policyDefinitionGroups | The metadata describing groups of policy definition references within the policy set definition. | PolicyDefinitionGroup[] |
| policyDefinitions | An array of policy definition references. | PolicyDefinitionReference[] (required) |
| policyType | The type of policy set definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. | 'BuiltIn' 'Custom' 'NotSpecified' 'Static' |
| version | The policy set definition version in #.#.# format. | string |
| versions | A list of available versions for this policy set definition. | string[] |
Usage Examples
Terraform Samples
A basic example of deploying policy set definition.
terraform {
required_providers {
azapi = {
source = "Azure/azapi"
}
}
}
provider "azapi" {
skip_provider_registration = false
}
variable "resource_name" {
type = string
default = "acctest0001"
}
variable "location" {
type = string
default = "westus"
}
data "azapi_client_config" "current" {}
resource "azapi_resource" "policyDefinition" {
type = "Microsoft.Authorization/policyDefinitions@2021-06-01"
parent_id = "/subscriptions/${data.azurerm_client_config.current.subscription_id}"
name = var.resource_name
body = {
properties = {
description = ""
displayName = "my-policy-definition"
mode = "All"
parameters = {
allowedLocations = {
metadata = {
description = "The list of allowed locations for resources."
displayName = "Allowed locations"
strongType = "location"
}
type = "Array"
}
}
policyRule = {
if = {
not = {
field = "location"
in = "[parameters('allowedLocations')]"
}
}
then = {
effect = "audit"
}
}
policyType = "Custom"
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "policySetDefinition" {
type = "Microsoft.Authorization/policySetDefinitions@2025-01-01"
parent_id = "/subscriptions/${data.azapi_client_config.current.subscription_id}"
name = "acctestpolset-${var.resource_name}"
body = {
properties = {
description = ""
displayName = "acctestpolset-${var.resource_name}"
parameters = {
allowedLocations = {
metadata = {
description = "The list of allowed locations for resources."
displayName = "Allowed locations"
strongType = "location"
}
type = "Array"
}
}
policyDefinitions = [{
groupNames = []
parameters = {
listOfAllowedLocations = {
value = "[parameters('allowedLocations')]"
}
}
policyDefinitionId = azapi_resource.policyDefinition.id
policyDefinitionReferenceId = ""
}]
policyType = "Custom"
}
}
}