Update Tags to multiple Logic Apps using REST API

This post has been republished via RSS; it originally appeared at: Microsoft Tech Community - Latest Blogs - .

Tags are a crucial part of organizing your Azure resources into a taxonomy No matter how or why you use tags, it's important that you can quickly add, change, and remove those tags on your Azure resources. We can apply tags to Azure resources, resource groups, and subscriptions to logically organize them. Each tag consists of a name and a value pair.

 

In this blog let’s see how to add tags to multiple Logic Apps using REST API,

 

REST API to update tags at scope:                 

Below REST API creates or updates the tags on a resource group

https://management.azure.com/subscriptions/{subscriptionid}/resourcegroups/{resourcegroup}/providers/Microsoft.Resources/tags/default?api-version=2021-04-01

Below REST API creates or updates the tags on a subscription

https://management.azure.com/subscriptions/{subscriptionid}/providers/Microsoft.Resources/tags/default?api-version=2021-04-01

 

Joyce_Dorothy_4-1632947589692.png

 

Get the list of workflows using the below Graph API where we need to apply the tags.

https://management.azure.com/providers/Microsoft.ResourceGraph/resources?api-version=2018-09-01-preview

 

Joyce_Dorothy_5-1632947589697.png

 

Update the retrieved workflow names to an array variable.

Note: Initialize an Integer variable (int_Index) with value ‘0’ and also initialize an Array variable(Array_workflow) with null value. Count represents the number of LogicApps workflow available in the provided subscription.

The field count can be retrieved from the raw output of ‘Get Workflows’ action. Use ‘Parse JSON’ action to retrieve only the count property.

 

Joyce_Dorothy_6-1632947589700.png

 

Within for-each loop, use the below REST API to apply tags at the workflows

https://management.azure.com/subscriptions/17374829-58e6-426f-ae3b-007191bf70b5/resourcegroups/LogicAppConsumption/providers/Microsoft.Logic/workflows/@{variables('Array_workflow')[variables('int_workflow')]}/providers/Microsoft.Resources/tags/default?api-version=2021-04-01

Note: Initialize an Integer variable (int_workflow) with value ‘0’ before using it inside the For-each loop.

 

Joyce_Dorothy_7-1632947589705.png

 

 

DisclaimerManaged Integration Service Environment connectors currently don't support tags

https://docs.microsoft.com/en-us/azure/logic-apps/add-artifacts-integration-service-environment-ise

REMEMBER: these articles are REPUBLISHED. Your best bet to get a reply is to follow the link at the top of the post to the ORIGINAL post! BUT you're more than welcome to start discussions here:

This site uses Akismet to reduce spam. Learn how your comment data is processed.