Azure策略允许使用喜欢/匹配模式的资源类型

时间:2019-03-26 14:52:15

标签: azure policies

在Azure策略“允许的资源类型”中,可以提供一系列资源类型。当我要允许SQL Elastic Pool时,我还需要包括SQL Elastic Pool的所有子类型。

我想使用:

'Microsoft.Sql/servers/elasticpools/*'
'Microsoft.Sql/servers/elasticPools/advisors/*'
'Microsoft.Sql/servers/elasticpools/elasticpool/advisors/*'
'microsoft.web/serverfarms/*
'microsoft.web/sites/*

但这不起作用。

我们现在使用:

'Microsoft.Sql/servers/elasticpools'
'Microsoft.Sql/servers/elasticPools/advisors'
'Microsoft.Sql/servers/elasticpools/advisors/createindex'
'Microsoft.Sql/servers/elasticpools/advisors/dbparameterization'
'Microsoft.Sql/servers/elasticpools/advisors/defragmentindex'
'Microsoft.Sql/servers/elasticpools/advisors/dropindex'
'Microsoft.Sql/servers/elasticpools/advisors/forcelastgoodplan'
'Microsoft.Sql/servers/elasticpools/elasticpool/advisors/createindex'
'Microsoft.Sql/servers/elasticpools/elasticpool/advisors/dbparameterization'
'Microsoft.Sql/servers/elasticpools/elasticpool/advisors/defragmentindex'
'Microsoft.Sql/servers/elasticpools/elasticpool/advisors/dropindex'
'Microsoft.Sql/servers/elasticpools/elasticpool/advisors/forcelastgoodplan'
'Microsoft.Web/sites/config'
'Microsoft.Web/sites/...'

我们使用的政策是:

{
  "if": {
    "not": {
      "field": "type",
      "in": "[parameters('listOfResourceTypesAllowed')]"
    }
  },
  "then": {
    "effect": "[parameters('Effect')]"
  }
}

政策参数:

{
  "listOfResourceTypesAllowed": {
    "type": "array",
    "metadata": {
      "displayName": "Allowed resource types",
      "description": "The list of resource types that can be deployed.",
      "strongType": "resourceTypes"
    }
  },
  "Effect": {
    "type": "string",
    "metadata": {
      "description": "The effect of the policy."
    }
  }
}

问题是否可以使用通配符或类似的东西?

0 个答案:

没有答案