Home > Software design >  How to Create Azure Resource Graph Explorer Scheduled Reports and Email Alerts
How to Create Azure Resource Graph Explorer Scheduled Reports and Email Alerts

Time:12-05

I have a Kusto query taken from enter image description here

One:

enter image description here

Two:

With

  • URL: enter image description here

    Three:

    Where I parse the Body and I give an extract of the JSON Schema:

    {
        "count": 3,
        "data": [
            {
                "count_": 3,
                "vmPowerState": "PowerState/stopped"
            },
            {
                "count_": 29,
                "vmPowerState": "PowerState/deallocated"
            },
            {
                "count_": 118,
                "vmPowerState": "PowerState/running"
            }
        ],
        "skip_token": null,
        "total_records": 3
    }
    

    Here I have a few doubt because I found enter image description here

    Four:

    enter image description here

    Five:

    Where I create the attachment from the CSV

    enter image description here

    The e-mail in the end arrives but the attachment is not a CSV, it's a JSON file:

    enter image description here

    What the hack am I doing wrong?

    CodePudding user response:

    if you want to use "Create CSV table" with Columns set to "Automatic", do pass the "body" of "parse Json". enter image description here

    you don't need to use the array variable but whatever you use need to return an array like this:

    enter image description here

    The body of the json parser on your example has many other json nodes enveloping that. You should have the option "data" as there is an array there called "data"

    if you want to cut it short, try "data"

    enter image description here

    you can change to "custom". that would allow you to remove redundant data or format data (like the "PowerState" in "PowerState/stopped"): enter image description here

    you can also add the .csv to the file name: enter image description here

    The above worked for me but it can be enhanced

    enter image description here

    CodePudding user response:

    The suggestoin posted by @BrunoLucasAzure really helped me understand how Logic Apps works.

    However I would like to reply to my own question with the right solution: I had to paste a sample of the JSON output pressing on the button Use sample payload to generate schema.

    enter image description here

    Then follow the workflow and everything will be fine.

    The next problem I need to fix is pagination but apparently there is a solution for that too: https://techcommunity.microsoft.com/t5/integrations-on-azure-blog/logic-app-http-pagination-deeper-look-build-custom-paging/ba-p/2907605

  • Related