首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >限制/拒绝资源的允许位置

限制/拒绝资源的允许位置
EN

Stack Overflow用户
提问于 2022-11-29 00:55:52
回答 1查看 49关注 0票数 0

我希望分配资源政策,以限制允许的地点,资源可以部署,这样我可以只使用特定的资源,我的工作和成本将是低的。我找到了,但这就像手动限制一样,我需要用脚本的方式。

我在网络里搜索,但没有找到任何相关的医生。有人能帮上忙吗?谢谢。

EN

回答 1

Stack Overflow用户

发布于 2022-12-02 14:33:38

我按照下面的配置拒绝资源允许的位置。

转到Portal→并搜索Policy策略定义

我已经填充了适当的字段,并使用下面的脚本拒绝分配位置

代码语言:javascript
运行
复制
 { 
"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"
}
}

我已经分配了政策,当我签入作业时,我可以看到

当我检查创建不允许位置的资源组时,我无法创建

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74608047

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档