我想制作 Azure 策略脚本,将每个资源组创建的虚拟机数量限制为最多 2 个?
下面代码块中的策略有什么问题?
{
"mode": "All",
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Compute/virtualMachines"
}
]
},
"then": {
"effect": "deny",
"details": {
"type": "Microsoft.Compute/virtualMachines",
"existenceCondition": {
"field": "count",
"equals": "[parameters('maxVmCount')]"
}
}
}
},
"parameters": {
"maxVmCount": {
"type": "Integer",
"metadata": {
"displayName": "Allowed Virtual Machine capacities"
}
}
}
}
我想创建一个策略,允许为每个新创建的资源组创建最多两个虚拟机。
你找到解决你的限制愿望了吗?我也需要同样的东西,但我被阻止了 谢谢