Download Logic app run history from internal ISE
Published Aug 02 2021 01:18 AM 3,393 Views

If you have an internal ISE then you will have difficulties to see the run history for the actions especially for failing action and during the development 

 

Usually you need to create Virtual machine connected to the same Vnet to be able to see these logs from Azure Portal.

 

If you open the failed run for one of the logic app from a machine which is not connected to ISE vnet,  you will get the below error

Unexpected error. Failed to fetch 

Mohammed_Barqawi_2-1627836071369.png

And the reason for this problem is due to  browser does not have permissions to the endpoint

if you review the network panel for chrome dev tool you will find that there are some failed requests

 

Mohammed_Barqawi_4-1627836146572.png

 

 

You could filter these request if you used the keyword  status-code:0

Mohammed_Barqawi_5-1627836345878.png

 

the URL should look like the below 

 

 

 

https://XXXXX.environments.microsoftazurelogicapps.net/workflows/1de86f92423740c288d1e7dbc023acb7/runs/08585806484034675541062779121CU00/actions/HTTP/contents/ActionOutputs?api-version=2016-10-01&se=2021-08-01T18%3A00%3A00.0000000Z&sp=%2Fruns%2F08585806484034675541062779121CU00%2Factions%2FHTTP%2Fcontents%2FActionOutputs%2Fread&sv=1.0&sig=XXXX"

 

 

 

The Solution 

 

The workaround was to build a flow inside the same ISE that can download these files and send it in email or store it in storage account

 

Mohammed_Barqawi_6-1627836385415.png

 

Send Email with the file content as attachment

 

Mohammed_Barqawi_0-1627845476897.png

 

 

Unfortunately, the Url need to be fixed in the logic app flow since there is no way to call this Logic app with parameters even if you use the feature run with payload because in this case the request will be initiated from Developer machine

 

Mohammed_Barqawi_8-1627836459535.png

 

The source code for the Downloader flow

 

 

{
    "definition": {
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
        "actions": {
            "Download_HTTP": {
                "inputs": {
                    "method": "GET",
                    "uri": "@variables('URL_to_Download')"
                },
                "runAfter": {
                    "URL": [
                        "Succeeded"
                    ]
                },
                "type": "Http"
            },
            "Send_an_email_(V2)": {
                "inputs": {
                    "body": {
                        "Attachments": [
                            {
                                "ContentBytes": "@{base64(body('Download_HTTP'))}",
                                "Name": "Run.json"
                            }
                        ],
                        "Body": "<p>URL is<br>\n@{variables('URL_to_Download')}</p>",
                        "Subject": "Run information @{utcNow()}",
                        "To": "...."
                    },
                    "host": {
                        "connection": {
                            "name": "@parameters('$connections')['office365_2']['connectionId']"
                        }
                    },
                    "method": "post",
                    "path": "/v2/Mail"
                },
                "runAfter": {
                    "Download_HTTP": [
                        "Succeeded"
                    ]
                },
                "type": "ApiConnection"
            },
            "URL": {
                "inputs": {
                    "variables": [
                        {
                            "name": "URL_to_Download",
                            "type": "string",
                            "value": "https://.."
                        }
                    ]
                },
                "runAfter": {},
                "type": "InitializeVariable"
            }
        },
        "contentVersion": "1.0.0.0",
        "outputs": {},
        "parameters": {
            "$connections": {
                "defaultValue": {},
                "type": "Object"
            }
        },
        "triggers": {
            "manual": {
                "inputs": {
                    "schema": {}
                },
                "kind": "Http",
                "type": "Request"
            }
        }
    },
    "parameters": {
        "$connections": {
            "value": {
                "office365_2": {
                    "connectionId": "/subscriptions/../resourceGroups/CSS-ISE-TEST/providers/Microsoft.Web/connections/office365-9",
                    "connectionName": "office365-9",
                    "id": "/subscriptions/.../providers/Microsoft.Web/locations/westus/managedApis/office365"
                }
            }
        }
    }
}

 

 

 

 

 

Co-Authors
Version history
Last update:
‎Aug 02 2021 01:18 AM
Updated by: