skip to Main Content

I’m trying to replace the report I have been running via Powershell with a Logic App, to automate it and store the results in Sharepoint. However, I can’t find a way to list the subscription tags and theit values within the logic app, only the tag names or the tag names and values for the resources hosted in the subscription. The main problem is all the tags aren’t always present, so it has to be a dynamic list.

I have been trying to use the action "Get tags for each subscription", iterating theough the subscription list as it was the recommended one, but it lists the tags and values for all the nested resources.

I have also been trying to create a Kusta query to list the tags and their valules, but that only brought out the tag names.

2

Answers


  1. You can get subscription name from List subscriptions action and tag value List subscription resource tags in logic app using below design:

    enter image description here

    Output:

    enter image description here

    Also refer this SO-Thread.

    Login or Signup to reply.
  2. In a Logic App, you need to use 2 HTTP actions: the first one to get a list of subscriptions, and the second to get the tags from each subscription.

    enter image description here

    Your first GET request goes to https://management.azure.com/subscriptions?api-version=2020-01-01

    Response:

    enter image description here

    The For each action will iterate the array with the subscription details:

    enter image description here

    The second GET request goes to https://management.azure.com/subscriptions/@{item()?[‘subscriptionId’]}/providers/Microsoft.Resources/tags/default?api-version=2021-04-01 –

    enter image description here

    Result:

    enter image description here

    Update: The other provided answer does the same but with the help of the Azure Resource Manager connector, which might seem to be a better approach if you didn’t want to use HTTP actions 🙂

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search