Policy Definitions - List By Management Group
Retrieve policy definitions in a management group
This operation retrieves a list of all the policy definitions in a given management group that match the optional given $filter. Valid values for $filter are: 'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not provided, the unfiltered list includes all policy definitions associated with the management group, including those that apply directly or from management groups that contain the given management group. If $filter=atExactScope() is provided, the returned list only includes all policy definitions that at the given management group. If $filter='policyType -eq {value}' is provided, the returned list only includes all policy definitions whose type match the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq {value}' is provided, the returned list only includes all policy definitions whose category match the {value}.
GET https://management.azure.com/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions?api-version=2023-04-01
GET https://management.azure.com/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions?api-version=2023-04-01&$filter={$filter}&$top={$top}
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
management
|
path | True |
string |
The ID of the management group. |
api-version
|
query | True |
string |
The API version to use for this operation. |
$filter
|
query |
string |
The filter to apply on the operation. Valid values for $filter are: 'atExactScope()', 'policyType -eq {value}' or 'category eq '{value}''. If $filter is not provided, no filtering is performed. If $filter=atExactScope() is provided, the returned list only includes all policy definitions that at the given scope. If $filter='policyType -eq {value}' is provided, the returned list only includes all policy definitions whose type match the {value}. Possible policyType values are NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq {value}' is provided, the returned list only includes all policy definitions whose category match the {value}. |
|
$top
|
query |
integer int32 |
Maximum number of records to return. When the $top filter is not provided, it will return 500 records. |
Responses
Name | Type | Description |
---|---|---|
200 OK |
OK - Returns an array of policy definitions. |
|
Other Status Codes |
Error response describing why the operation failed. |
Security
azure_auth
Azure Active Directory OAuth2 Flow.
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name | Description |
---|---|
user_impersonation | impersonate your user account |
Examples
List policy definitions by management group
Sample request
Sample response
{
"value": [
{
"properties": {
"mode": "All",
"displayName": "Allowed storage account SKUs",
"policyType": "BuiltIn",
"description": "This policy enables you to specify a set of storage account SKUs that your organization can deploy.",
"parameters": {
"listOfAllowedSKUs": {
"type": "Array",
"metadata": {
"description": "The list of SKUs that can be specified for storage accounts.",
"displayName": "Allowed SKUs",
"strongType": "StorageSKUs"
}
}
},
"version": "1.2.1",
"versions": [
"1.2.1",
"1.0.0"
],
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Storage/storageAccounts"
},
{
"not": {
"field": "Microsoft.Storage/storageAccounts/sku.name",
"in": "[parameters('listOfAllowedSKUs')]"
}
}
]
},
"then": {
"effect": "Deny"
}
}
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1",
"type": "Microsoft.Authorization/policyDefinitions",
"name": "7433c107-6db4-4ad1-b57a-a76dce0154a1"
},
{
"id": "/providers/Microsoft.Management/managementgroups/MyManagementGroup/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming",
"type": "Microsoft.Authorization/policyDefinitions",
"name": "ResourceNaming",
"properties": {
"mode": "All",
"displayName": "Naming Convention",
"description": "Force resource names to begin with 'prefix' and end with 'suffix'",
"metadata": {
"category": "Naming"
},
"version": "1.2.1",
"versions": [
"1.2.1",
"1.0.0"
],
"policyRule": {
"if": {
"not": {
"field": "name",
"like": "[concat(parameters('prefix'), '*', parameters('suffix'))]"
}
},
"then": {
"effect": "deny"
}
},
"parameters": {
"prefix": {
"type": "String",
"metadata": {
"displayName": "Prefix",
"description": "Resource name prefix"
}
},
"suffix": {
"type": "String",
"metadata": {
"displayName": "Suffix",
"description": "Resource name suffix"
}
}
},
"policyType": "Custom"
}
}
]
}
Definitions
Name | Description |
---|---|
Cloud |
An error response from a policy operation. |
created |
The type of identity that created the resource. |
Error |
The resource management error additional info. |
Error |
Error Response |
Metadata |
General metadata for the parameter. |
Parameter |
The definition of a parameter that can be provided to the policy. |
parameter |
The data type of the parameter. |
Policy |
The policy definition. |
Policy |
List of policy definitions. |
policy |
The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. |
system |
Metadata pertaining to creation and last modification of the resource. |
CloudError
An error response from a policy operation.
Name | Type | Description |
---|---|---|
error |
Error Response |
createdByType
The type of identity that created the resource.
Name | Type | Description |
---|---|---|
Application |
string |
|
Key |
string |
|
ManagedIdentity |
string |
|
User |
string |
ErrorAdditionalInfo
The resource management error additional info.
Name | Type | Description |
---|---|---|
info |
object |
The additional info. |
type |
string |
The additional info type. |
ErrorResponse
Error Response
Name | Type | Description |
---|---|---|
additionalInfo |
The error additional info. |
|
code |
string |
The error code. |
details |
The error details. |
|
message |
string |
The error message. |
target |
string |
The error target. |
Metadata
General metadata for the parameter.
Name | Type | Description |
---|---|---|
assignPermissions |
boolean |
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. |
description |
string |
The description of the parameter. |
displayName |
string |
The display name for the parameter. |
strongType |
string |
Used when assigning the policy definition through the portal. Provides a context aware list of values for the user to choose from. |
ParameterDefinitionsValue
The definition of a parameter that can be provided to the policy.
Name | Type | Description |
---|---|---|
allowedValues |
object[] |
The allowed values for the parameter. |
defaultValue |
object |
The default value for the parameter if no value is provided. |
metadata |
General metadata for the parameter. |
|
schema |
object |
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. |
parameterType
The data type of the parameter.
Name | Type | Description |
---|---|---|
Array |
string |
|
Boolean |
string |
|
DateTime |
string |
|
Float |
string |
|
Integer |
string |
|
Object |
string |
|
String |
string |
PolicyDefinition
The policy definition.
Name | Type | Default value | Description |
---|---|---|---|
id |
string |
The ID of the policy definition. |
|
name |
string |
The name of the policy definition. |
|
properties.description |
string |
The policy definition description. |
|
properties.displayName |
string |
The display name of the policy definition. |
|
properties.metadata |
object |
The policy definition metadata. Metadata is an open ended object and is typically a collection of key value pairs. |
|
properties.mode |
string |
Indexed |
The policy definition mode. Some examples are All, Indexed, Microsoft.KeyVault.Data. |
properties.parameters |
<string,
Parameter |
The parameter definitions for parameters used in the policy rule. The keys are the parameter names. |
|
properties.policyRule |
object |
The policy rule. |
|
properties.policyType |
The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static. |
||
properties.version |
string |
The policy definition version in #.#.# format. |
|
properties.versions |
string[] |
A list of available versions for this policy definition. |
|
systemData |
The system metadata relating to this resource. |
||
type |
string |
The type of the resource (Microsoft.Authorization/policyDefinitions). |
PolicyDefinitionListResult
List of policy definitions.
Name | Type | Description |
---|---|---|
nextLink |
string |
The URL to use for getting the next set of results. |
value |
An array of policy definitions. |
policyType
The type of policy definition. Possible values are NotSpecified, BuiltIn, Custom, and Static.
Name | Type | Description |
---|---|---|
BuiltIn |
string |
|
Custom |
string |
|
NotSpecified |
string |
|
Static |
string |
systemData
Metadata pertaining to creation and last modification of the resource.
Name | Type | Description |
---|---|---|
createdAt |
string |
The timestamp of resource creation (UTC). |
createdBy |
string |
The identity that created the resource. |
createdByType |
The type of identity that created the resource. |
|
lastModifiedAt |
string |
The timestamp of resource last modification (UTC) |
lastModifiedBy |
string |
The identity that last modified the resource. |
lastModifiedByType |
The type of identity that last modified the resource. |