0

I am searching for a CLI way to set tags on an azure apim api instance. I am talking about an API tag, which seems to be different from tags on that api-service or other api resources. This means that (to my knowledge) Get-AzTag -ResourceId doesn't work for api's (I have done it with the id of the api and the list is empty, while the portal shows tags). Having to do this for 300+ interfaces using the azure portal is a bit cumbersome .

What I mean in the azure portal

1 Answers1

0

There are two ways where azure cli offers to applying tags :

.az tag create

.az tag update

Below is an example for create a tag :

 az tag create --resource-id  $resource  --tags Dept=Finance Status=Normal

To get list of tags you can use below example code:

 az tag list --resource-id 

For further details Please refer this link:- . Using azure cli Apply tags. .

Secondary ,we can add /set tags using Powershell as well to our api of APIM.

AjayKumarGhose
  • 4,257
  • 2
  • 4
  • 15
  • 1
    Hello, your solution can set a tag on APIM instance but (to my knowledge) not on an API inside the APIM itself. These kinds of tags are not of the (name,value)-pair kind. – Willy Van den Driessche Jul 29 '21 at 13:34
  • Could you please refer this [Git-hub Issue](https://github.com/MicrosoftDocs/azure-docs/issues/21817). – AjayKumarGhose Jul 29 '21 at 13:41
  • Hello, from the git issue it seems that you are right. Unfortunately (and this has nothing to with your suggestions) I have not been able to get this to work. It is not clear what I need to do in powershell and there seem to be two competing but incompatible versions of the toolings. I'll ask our operations guys to hav e ago at it. They are more experienced in PowerShell. Tx already for the suggestions. I'll upvote it once I can confirm (from experience) that it works. – Willy Van den Driessche Jul 30 '21 at 09:23