0

We have a requirement to force certain tags to our azure resources. Some tags which we need to enforce from subscription level say(eg: st1=st1, st2=st2..), But some are needed to be resourcegroup level(rt1-rt1, rt2=rt2..) and others are to specific resource type (like, aks, appservice, storage account).

By going through the MS doc I found that this can be achieved using azure policy. So the plan is to create azure policy with allowed tags and tag values which need to be enforced on

   i) in subscription level  
   2) resource group level  
   3) Resource type wise  
   4) and for other remaining app specific tags to the resources use "az tag update" command.

We need to use automated solution to achieve all these with Azurepipleine and shell commands or scripts as we have only linux machines.

so for the 4th point i got some working pipeline solution to add the app specific tags to the resource level.

But for the requirements 1 to 3, will there any arm or script already available , so that we can integrate them with our azurepipelines.

Any automated solution or suggestion you already tried on this?

Vowneee
  • 956
  • 10
  • 33

1 Answers1

0

update on 12/12

As this docs for Use Tags to organize your azure resources sharing to us, you could use rest api or sdk to add the tags for your resource.

And for the loop for giving the resources with the tags from the resource groups. You could look into this potential workaround for reference. Bash Script

Ceeno Qi-MSFT
  • 924
  • 1
  • 3
  • 5
  • I guess, here it will not enforce the tagging from resource group to resources. Also the for loop of given resources will not work here I guess. I thing there is some option with azure policy for enforcing the tagging to the resources. Also in my case PowerShell script wont work as i have linux buildagents only. – Vowneee Dec 10 '22 at 08:40