我希望分配资源政策,以限制允许的地点,资源可以部署,这样我可以只使用特定的资源,我的工作和成本将是低的。我找到了这,但这就像手动限制一样,我需要用脚本的方式。
我在网络里搜索,但没有找到任何相关的医生。有人能帮上忙吗?谢谢。
发布于 2022-12-02 14:33:38
我按照下面的配置拒绝资源允许的位置。
转到Portal→并搜索Policy和策略定义
我已经填充了适当的字段,并使用下面的脚本拒绝分配位置
{
"properties": {
"displayName": "Allowed resource types",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "This policy enables you to specify the resource types that your organization can deploy. Only resource types that support 'tags' and 'location' will be affected by this policy. To restrict all resources please duplicate this policy and change the 'mode' to 'All'.",
"metadata": {
"version": "1.0.0",
"category": "General"
},
"parameters": {
"listOfResourceTypesAllowed": {
"type": "Array",
"metadata": {
"description": "The list of resource types that can be deployed.",
"displayName": "Allowed resource types",
"strongType": "resourceTypes"
}
}
},
"policyRule": {
"if": {
"not": {
"field": "type",
"in": "[parameters('listOfResourceTypesAllowed')]"
}
},
"then": {
"effect": "deny"
}
}
我已经分配了政策,当我签入作业时,我可以看到
当我检查创建不允许位置的资源组时,我无法创建
https://stackoverflow.com/questions/74608047
复制相似问题