如何使用策略实施 Azure App Service 计划层
How to enforce Azure App Service plan tier using a policy
我是 Azure 的新手,我正在研究如何使用策略来实施治理。我整理了这个政策定义:
{
"mode": "All",
"policyRule": {
"if": {
"not": {
"field": "kind",
"in": "[parameters('allowedSKUs')]"
}
},
"then": {
"effect": "deny"
}
},
"parameters": {
"allowedSKUs": {
"type": "Array",
"metadata": {
"displayName": "Allowed Storage SKU",
"description": "The list of allowed skus for resources.",
"strongType": "storageSkus"
}
}
}
}
我希望能够为在分配的订阅中创建的所有应用服务计划强制执行“F1”定价层,但它似乎只在分配此策略时使“存储选项”对我可用。我如何使用 Azure Policy 定义强制执行此操作。
检查这个:
{
"mode": "Indexed",
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Web/serverfarms"
},
{
"not": {
"field": "Microsoft.Web/serverfarms/sku.name",
"in": "[parameters('listOfAllowedSKUs')]"
}
}
]
},
"then": {
"effect": "Deny"
}
},
"parameters": {
"listOfAllowedSKUs": {
"type": "Array",
"metadata": {
"displayName": "Allowed SKUs",
"description": "The list of SKUs that can be specified"
},
"defaultValue": ["F1"]
}
}
}
我找不到适合应用 SKU 的强类型。
我是 Azure 的新手,我正在研究如何使用策略来实施治理。我整理了这个政策定义:
{
"mode": "All",
"policyRule": {
"if": {
"not": {
"field": "kind",
"in": "[parameters('allowedSKUs')]"
}
},
"then": {
"effect": "deny"
}
},
"parameters": {
"allowedSKUs": {
"type": "Array",
"metadata": {
"displayName": "Allowed Storage SKU",
"description": "The list of allowed skus for resources.",
"strongType": "storageSkus"
}
}
}
}
我希望能够为在分配的订阅中创建的所有应用服务计划强制执行“F1”定价层,但它似乎只在分配此策略时使“存储选项”对我可用。我如何使用 Azure Policy 定义强制执行此操作。
检查这个:
{
"mode": "Indexed",
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Web/serverfarms"
},
{
"not": {
"field": "Microsoft.Web/serverfarms/sku.name",
"in": "[parameters('listOfAllowedSKUs')]"
}
}
]
},
"then": {
"effect": "Deny"
}
},
"parameters": {
"listOfAllowedSKUs": {
"type": "Array",
"metadata": {
"displayName": "Allowed SKUs",
"description": "The list of SKUs that can be specified"
},
"defaultValue": ["F1"]
}
}
}
我找不到适合应用 SKU 的强类型。