Microsoft.Authorization policyDefinitions
Bicep resource definition
The policyDefinitions resource type is an extension resource, which means you can apply it to another resource.
Use the scope
property on this resource to set the scope for this resource. See Set scope on extension resources in Bicep.
The policyDefinitions resource type can be deployed with operations that target:
- Management groups - See management group deployment commands
- Subscriptions - See subscription deployment commands
You can reference this resource type as a read-only resource at level of: Tenants
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.Authorization/policyDefinitions resource, add the following Bicep to your template.
resource symbolicname 'Microsoft.Authorization/policyDefinitions@2023-04-01' = {
name: 'string'
scope: resourceSymbolicName
properties: {
description: 'string'
displayName: 'string'
metadata: any()
mode: 'string'
parameters: {
{customized property}: {
allowedValues: [
any
]
defaultValue: any()
metadata: {
assignPermissions: bool
description: 'string'
displayName: 'string'
strongType: 'string'
{customized property}: any()
}
schema: any()
type: 'string'
}
}
policyRule: any()
policyType: 'string'
version: 'string'
versions: [
'string'
]
}
}
Property values
policyDefinitions
Name | Description | Value |
---|---|---|
name | The resource name | string (required) Character limit: 1-128 display name 1-64 resource name Valid characters: Display name can contain any characters. Resource name can't use: <>*%&:\?+/ or control characters. Can't end with period or space. |
scope | Use when creating an extension resource at a scope that is different than the deployment scope. | Target resource For Bicep, set this property to the symbolic name of the resource to apply the extension resource. |
properties | The policy definition properties. | PolicyDefinitionProperties |
PolicyDefinitionProperties
Name | Description | Value |
---|---|---|
description | The policy definition description. | string |
displayName | The display name of the policy definition. | string |
metadata | The policy definition metadata. Metadata is an open ended object and is typically a collection of key value pairs. | For Bicep, you can use the any() function. |
mode | The policy definition mode. Some examples are All, Indexed, Microsoft.KeyVault.Data. | string |
parameters | The parameter definitions for parameters used in the policy rule. The keys are the parameter names. | ParameterDefinitions |
policyRule | The policy rule. | For Bicep, you can use the any() function. |
policyType | The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. | 'BuiltIn' 'Custom' 'NotSpecified' 'Static' |
version | The policy definition version in #.#.# format. | string |
versions | A list of available versions for this policy definition. | string[] |
ParameterDefinitions
Name | Description | Value |
---|---|---|
{customized property} | ParameterDefinitionsValue |
ParameterDefinitionsValue
Name | Description | Value |
---|---|---|
allowedValues | The allowed values for the parameter. | any[] |
defaultValue | The default value for the parameter if no value is provided. | For Bicep, you can use the any() function. |
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/. |
For Bicep, you can use the any() function. |
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 |
{customized property} | For Bicep, you can use the any() function. |
Quickstart templates
The following quickstart templates deploy this resource type.
Template | Description |
---|---|
Deploy a policy definition and assign to a management group |
This template is a management group level template that will create a policy definition and assign that policy to the target management group. Currently, this template cannot be deployed via the Azure Portal. |
Deploy a Policy Def and Assign to Multiple Mgmt Groups |
This template is a management group level template that will create a policy definition and assign that policy to multiple management groups. |
Create an Azure Virtual Network Manager and sample VNETs |
This template deploys an Azure Virtual Network Manager and sample virtual networks into the named resource group. It supports multiple connectivity topologies and network group membership types. |
ARM template resource definition
The policyDefinitions resource type is an extension resource, which means you can apply it to another resource.
Use the scope
property on this resource to set the scope for this resource. See Set scope on extension resources in ARM templates.
The policyDefinitions resource type can be deployed with operations that target:
- Management groups - See management group deployment commands
- Subscriptions - See subscription deployment commands
You can reference this resource type as a read-only resource at level of: Tenants
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.Authorization/policyDefinitions resource, add the following JSON to your template.
{
"type": "Microsoft.Authorization/policyDefinitions",
"apiVersion": "2023-04-01",
"name": "string",
"scope": "string",
"properties": {
"description": "string",
"displayName": "string",
"metadata": {},
"mode": "string",
"parameters": {
"{customized property}": {
"allowedValues": [ object ],
"defaultValue": {},
"metadata": {
"assignPermissions": "bool",
"description": "string",
"displayName": "string",
"strongType": "string",
"{customized property}": {}
},
"schema": {},
"type": "string"
}
},
"policyRule": {},
"policyType": "string",
"version": "string",
"versions": [ "string" ]
}
}
Property values
policyDefinitions
Name | Description | Value |
---|---|---|
type | The resource type | 'Microsoft.Authorization/policyDefinitions' |
apiVersion | The resource api version | '2023-04-01' |
name | The resource name | string (required) Character limit: 1-128 display name 1-64 resource name Valid characters: Display name can contain any characters. Resource name can't use: <>*%&:\?+/ or control characters. Can't end with period or space. |
scope | Use when creating an extension resource at a scope that is different than the deployment scope. | Target resource For JSON, set the value to the full name of the resource to apply the extension resource to. |
properties | The policy definition properties. | PolicyDefinitionProperties |
PolicyDefinitionProperties
Name | Description | Value |
---|---|---|
description | The policy definition description. | string |
displayName | The display name of the policy definition. | string |
metadata | The policy definition metadata. Metadata is an open ended object and is typically a collection of key value pairs. | |
mode | The policy definition mode. Some examples are All, Indexed, Microsoft.KeyVault.Data. | string |
parameters | The parameter definitions for parameters used in the policy rule. The keys are the parameter names. | ParameterDefinitions |
policyRule | The policy rule. | |
policyType | The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. | 'BuiltIn' 'Custom' 'NotSpecified' 'Static' |
version | The policy definition version in #.#.# format. | string |
versions | A list of available versions for this policy definition. | string[] |
ParameterDefinitions
Name | Description | Value |
---|---|---|
{customized property} | ParameterDefinitionsValue |
ParameterDefinitionsValue
Name | Description | Value |
---|---|---|
allowedValues | The allowed values for the parameter. | any[] |
defaultValue | The default value for the parameter if no value is provided. | |
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/. |
|
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 |
{customized property} |
Quickstart templates
The following quickstart templates deploy this resource type.
Template | Description |
---|---|
Deploy a policy definition and assign to a management group |
This template is a management group level template that will create a policy definition and assign that policy to the target management group. Currently, this template cannot be deployed via the Azure Portal. |
Deploy a Policy Def and Assign to Multiple Mgmt Groups |
This template is a management group level template that will create a policy definition and assign that policy to multiple management groups. |
Create an Azure Virtual Network Manager and sample VNETs |
This template deploys an Azure Virtual Network Manager and sample virtual networks into the named resource group. It supports multiple connectivity topologies and network group membership types. |
Terraform (AzAPI provider) resource definition
The policyDefinitions resource type is an extension resource, which means you can apply it to another resource.
Use the parent_id
property on this resource to set the scope for this resource.
The policyDefinitions resource type can be deployed with operations that target:
- Management groups
- Subscriptions
You can reference this resource type as a read-only resource at level of: Tenants
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.Authorization/policyDefinitions resource, add the following Terraform to your template.
resource "azapi_resource" "symbolicname" {
type = "Microsoft.Authorization/policyDefinitions@2023-04-01"
name = "string"
parent_id = "string"
body = jsonencode({
properties = {
description = "string"
displayName = "string"
mode = "string"
parameters = {
{customized property} = {
allowedValues = [ object ]
metadata = {
assignPermissions = bool
description = "string"
displayName = "string"
strongType = "string"
}
type = "string"
}
}
policyType = "string"
version = "string"
versions = [
"string"
]
}
})
}
Property values
policyDefinitions
Name | Description | Value |
---|---|---|
type | The resource type | "Microsoft.Authorization/policyDefinitions@2023-04-01" |
name | The resource name | string (required) Character limit: 1-128 display name 1-64 resource name Valid characters: Display name can contain any characters. Resource name can't use: <>*%&:\?+/ or control characters. Can't end with period or space. |
parent_id | The ID of the resource to apply this extension resource to. | string (required) |
properties | The policy definition properties. | PolicyDefinitionProperties |
PolicyDefinitionProperties
Name | Description | Value |
---|---|---|
description | The policy definition description. | string |
displayName | The display name of the policy definition. | string |
metadata | The policy definition metadata. Metadata is an open ended object and is typically a collection of key value pairs. | |
mode | The policy definition mode. Some examples are All, Indexed, Microsoft.KeyVault.Data. | string |
parameters | The parameter definitions for parameters used in the policy rule. The keys are the parameter names. | ParameterDefinitions |
policyRule | The policy rule. | |
policyType | The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. | "BuiltIn" "Custom" "NotSpecified" "Static" |
version | The policy definition version in #.#.# format. | string |
versions | A list of available versions for this policy definition. | string[] |
ParameterDefinitions
Name | Description | Value |
---|---|---|
{customized property} | ParameterDefinitionsValue |
ParameterDefinitionsValue
Name | Description | Value |
---|---|---|
allowedValues | The allowed values for the parameter. | any[] |
defaultValue | The default value for the parameter if no value is provided. | |
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/. |
|
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 |
{customized property} |