Azure / logicapps

Azure Logic Apps labs, samples, and tools
MIT License
348 stars 291 forks source link

Querying Subscription tags via ARM action outputs more than one value #1041

Closed slimsshady76 closed 2 weeks ago

slimsshady76 commented 2 months ago

Describe the Bug with repro steps

If I query ARM via the "List Subscription Resource Tags" action in a Logic App I get several values for the same tag name. I'm not sure if this has to do with a value history or if the action is gathering values from the resources hosted in the subsciption.

What type of Logic App Is this happening in?

Consumption (Portal)

Are you using new designer or old designer

New Designer

Did you refer to the TSG before filing this issue? https://aka.ms/lauxtsg

Yes

Workflow JSON

{
  "definition": {
    "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
    "contentVersion": "1.0.0.0",
    "triggers": {
      "Recurrence": {
        "type": "Recurrence",
        "recurrence": {
          "frequency": "Day",
          "interval": 1,
          "timeZone": "Argentina Standard Time",
          "schedule": {
            "hours": [
              "2"
            ]
          }
        }
      }
    },
    "actions": {
      "For_each_subscription": {
        "type": "Foreach",
        "foreach": "@body('List_subscriptions')?['value']",
        "actions": {
          "List_subscription_resource_tags": {
            "type": "ApiConnection",
            "inputs": {
              "host": {
                "connection": {
                  "name": "@parameters('$connections')['arm']['connectionId']"
                }
              },
              "method": "get",
              "path": "/subscriptions/@{encodeURIComponent(items('For_each_subscription')?['subscriptionId'])}/tagNames",
              "queries": {
                "x-ms-api-version": "2016-06-01"
              }
            },
            "runAfter": {
              "Get_items": [
                "Succeeded"
              ]
            }
          },
          "Parse_JSON": {
            "type": "ParseJson",
            "inputs": {
              "content": "@body('List_subscription_resource_tags')",
              "schema": {
                "type": "object",
                "properties": {
                  "value": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "tagName": {
                          "type": "string"
                        },
                        "count": {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string"
                            },
                            "value": {
                              "type": "integer"
                            }
                          }
                        },
                        "values": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "tagValue": {
                                "type": "string"
                              },
                              "count": {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string"
                                  },
                                  "value": {
                                    "type": "integer"
                                  }
                                }
                              }
                            },
                            "required": [
                              "id",
                              "tagValue",
                              "count"
                            ]
                          }
                        }
                      },
                      "required": [
                        "id",
                        "tagName",
                        "count",
                        "values"
                      ]
                    }
                  }
                }
              }
            },
            "runAfter": {
              "List_subscription_resource_tags": [
                "Succeeded"
              ]
            }
          },

Screenshots or Videos

Screenshot 2024-04-18 092911

Browser

Microsoft Edge for Business Version 123.0.2420.81 (Official build) (64-bit)

Additional context

I am writing a logic app which iterates though all the available subscriptions, gathers a set of tags and their values, and writes them to an Excel file. As you can see from the screenshot, the tag BusinessApplicationName outputs several values, but when looked at from the Azure Portal, there is just one value for it.

AB#27712706

github-actions[bot] commented 4 weeks ago

This issue is stale because it has been open for 45 days with no activity.

github-actions[bot] commented 2 weeks ago

This issue was closed because it has been inactive for 14 days since being marked as stale.