MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.3k stars 21.48k forks source link

Provided Policy need to remove 'clusterTags' parameter and function associated to it #107636

Closed spotakash closed 1 year ago

spotakash commented 1 year ago

clusterTags create error while applying remediation task.

Policy Definition:

curl -o azurepolicy.json -L https://aka.ms/aks-enable-monitoring-custom-policy curl -o azurepolicy.rules.json -L https://aka.ms/aks-enable-monitoring-custom-policy-rules

Error Details

Code InvalidTemplate Message Deployment template validation failed: 'Template parameter 'clusterTags' was provided an invalid value. Expected a value of type 'Object', but received a value of type 'String'. Please see https://aka.ms/arm-create-parameter-file for usage details.'.

Even after changing clusterTags to string. Another error comes.

{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","details":[{"code":"InvalidTemplate","message":"Deployment template validation failed: 'The template resource 'mks' at line '1' and column '308' has invalid Tags property. The Tags property should be a dictionary or a valid expression. Please see https://aka.ms/arm-syntax-resources for usage details. '."}]}

Resolution:

Remove parameter clusterTag and associate code part inside policy code.

Policy which worked for me (even successful remediation)


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

YashikaTyagii commented 1 year ago

@spotakash Thanks for your feedback! We will investigate and update as appropriate.

bwren commented 1 year ago

I did some testing on it, and it turns out you get that error when the cluster has no tags. If you add at least one tag to the cluster, the remediation works fine. I'll add a note to the article about that.

please-close