My aim is to enforce the developers to provide tags while they create clusters. I have added a policy in my ARM template which creates an azure workspace. It successfully completes the validation but fails to deploy.Sorry if my question is vague. Please help
{
"$schema":"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion":"1.0.0.0",
"parameters":{
"workspaceName":{
"defaultValue":"xyxy",
"type":"String",
"metadata":{
"description":"The name of the Azure Databricks workspace to create."
}
},
"subscriptionName":{
"allowedValues":[
"yy",
"xx"
],
"type":"String",
"metadata":{
"description":"Specifies the subscription in which to create the workspace."
}
},
"resourceGroup":{
"defaultValue":"abc",
"allowedValues":[
"dd",
"bb",
"abc"
],
"type":"String",
"metadata":{
"description":"Resource group in which to create the workspace."
}
},
"pricingTier":{
"defaultValue":"premium",
"allowedValues":[
"standard",
"premium"
],
"type":"String",
"metadata":{
"description":"The pricing tier of workspace."
}
},
"location":{
"defaultValue":"east us",
"type":"String",
"metadata":{
"description":"Location for all resources."
}
}
},
"variables":{
"managedResourceGroupName":"[concat('databricks-rg-', parameters('workspaceName'), '-', uniqueString(parameters('workspaceName'), resourceGroup().id))]"
},
"resources":[
{
"type":"Microsoft.Databricks/workspaces",
"apiVersion":"2018-04-01",
"name":"[parameters('workspaceName')]",
"location":"[parameters('location')]",
"sku":{
"name":"[parameters('pricingTier')]"
},
"properties":{
"displayName":"Enforce tag and its value",
"policyType":"BuiltIn",
"ManagedResourceGroupId":"[concat(subscription().id, '/resourceGroups/', variables('managedResourceGroupName'))]",
"description":"Enforces a required tag and its value.",
"parameters":{
"tagName":{
"type":"String",
"metadata":{
"description":"Name of the tag, such as costCenter"
}
},
"tagValue":{
"type":"String",
"metadata":{
"description":"Value of the tag, such as headquarter"
}
}
},
"policyRule":{
"if":{
"not":{
"field":"[concat('tags[', parameters('tagName'), ']')]",
"equals":"[parameters('tagValue')]"
}
},
"then":{
"effect":"deny"
}
}
},
"outputs":{
"workspace":{
"type":"Object",
"value":"[reference(resourceId('Microsoft.Databricks/workspaces', parameters('workspaceName')))]"
}
}
}
]
}
Error: Unable to process template language expressions for resource '/subscriptions/04jdmgb-5642-8640-9a15-a0504248340f/resourceGroups/abc/providers/Microsoft.Databricks/workspaces/test12' at line '73' and column '9'. 'The template parameter 'tagName' is not found. Please see https://aka.ms/arm-template/#parameters for usage details.' Click here for details Your deployment faile