Hi
Answers to your questions below:
- Does an Azure Policy Definition that satisfies these conditions exist? If yes, please give me an example
Not that I'm aware of, so you'd need to create a custom Initiative - something like this:
"parameters": {
"maxResourceCount": {
"type": "Integer",
"metadata": {
"displayName": "Maximum Resource Count",
"description": "Enter the maximum number of resources allowed in a resource group."
},
"defaultValue": 10
}
},
"policyDefinitions": [
{
"displayName": "ResourceGroupResourceLimit",
"description": "Limits the number of resources in a resource group",
"policyType": "Custom",
"mode": "Indexed",
"parameters": {
"maxResourceCount": {
"value": "[parameters('maxResourceCount')]"
}
- If counting resources within a resource group before creating do not support, how can i restrict users from creating resources?
You can by creating "Deny" assignments in a policy, but IMHO, this isn't a policy question - its more to do with making sure your RBAC and the permissions assigned to the Resource Group and your subscriptions in general are set up correctly so that users only have the necessary permissions they need.
Hope this helps,
Thanks
Michael Durkan
- If the reply was helpful please upvote and/or accept as answer as this helps others in the community with similar questions. Thanks!