Deleting A Logic App Without Log Analytics Configured? Export Run Details For Preservation And Analysis with PowerShell

  • Luis Rigueira
  • Apr 11, 2024
  • 7 min read

Sometimes, companies must delete important Logic Apps while still keeping detailed run information. When Log Analytics is not configured, teams need another way to retain execution data. Keeping this information supports auditing, analysis, storage, and compliance requirements.

📝 One-Minute Brief

Preserve and analyze Azure Logic Apps run history before deleting workflows by exporting execution details with PowerShell, even when Log Analytics is not configured.

This script automates the process of retrieving all runs from a specified Logic App. It extracts the relevant details and exports them as .json files. You can then use these files for analysis or long‑term record keeping.

This PowerShell script offers several advantages in scenarios where users contemplate deleting a Logic App or encounter constraints due to the absence of Log Analytics configuration:

  • Mitigating Data Loss: Deleting a Logic App removes all run history and can erase valuable execution insights. By using this PowerShell script, teams can export run details before deletion and preserve critical data. In regulated or audited environments, maintaining execution records is essential. This script helps teams meet compliance requirements and supports thorough auditing.
  • Flexibility in Run Export: When Log Analytics is not available, the script offers a reliable alternative. It allows teams to export Logic App run details without any dependency on Log Analytics. Users can define the output directory and control file formats, making the export process flexible and easy to adapt to specific needs.
  • Automation and Efficiency: Instead of exporting run details manually, the script automates the entire process. It supports batch processing, which significantly reduces time and effort. Teams can also schedule the script to run at regular intervals, ensuring consistent and organized data exports.

This is an example of the result of using this PowerShell.

{
    "Run Details": {
        "properties": {
            "waitEndTime": "2024-03-01T07:10:28.9188779Z",
                       "startTime":  "2024-03-01T07:10:28.9188779Z",
                       "endTime":  "2024-03-01T07:14:01.1365889Z",
                       "status":  "Failed",
                       "code":  "ActionFailed",
                       "error":  {
                                     "code":  "ActionFailed",
                                     "message":  "An action failed. No dependent actions succeeded."
                                 },
                       "correlation":  {
                                           "clientTrackingId":  "08584923298565597836003987229CU207"
                                       },
                       "workflow":  {
                                        "id":  "/subscriptions/xxxxxxxxxxx/resourceGroups/XX-XXX-XX/providers/Microsoft.Logic/workflows/LA-XXXXXXXXX-POC/versions/xxxxxxxxxxxxxx",
                                        "name":  "xxxxxxxxxxxxxx",
                                        "type":  "Microsoft.Logic/workflows/versions"
                                    },
                       "trigger":  {
                                       "name":  "manual",
                                       "inputsLink":  {
                                                          "uri":  "https://prod-55.westeurope.logic.azure.com:443/workflows/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/runs/08584923298565597836003987229CU207/contents/TriggerInputs?api-version=2016-06-01\u0026se=2024-04-04T18%3A00%3A00.0000000Z\u0026sp=%2Fruns%2F08584923298565597836003987229CU207%2Fcontents%2FTriggerInputs%2Fread\u0026sv=1.0\u0026sig=0oO052pLkmJpj7DAepYpoYQPrTXnD17eABMoI_SuNpQ",
                                                          "contentVersion":  "SeXxiBX729iPh16dStbKtQ==",
                                                          "contentSize":  39,
                                                          "contentHash":  {
                                                                              "algorithm":  "md5",
                                                                              "value":  "SeXxiBX729iPh16dStbKtQ=="
                                                                          }
                                                      },
                                       "outputsLink":  {
                                                           "uri":  "https://prod-55.westeurope.logic.azure.com:443/workflows/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/runs/08584923298565597836003987229CU207/contents/TriggerOutputs?api-version=2016-06-01\u0026se=2024-04-04T18%3A00%3A00.0000000Z\u0026sp=%2Fruns%2F08584923298565597836003987229CU207%2Fcontents%2FTriggerOutputs%2Fread\u0026sv=1.0\u0026sig=xsKG2tc7jdxJJqo9A3W_MD0mIrGtpskbDcSseRqE-v0",
                                                           "contentVersion":  "a+Tspez2SVAZ9sIcPBAGSg==",
                                                           "contentSize":  1319,
                                                           "contentHash":  {
                                                                               "algorithm":  "md5",
                                                                               "value":  "a+Tspez2SVAZ9sIcPBAGSg=="
                                                                           }
                                                       },
                                       "startTime":  "2024-03-01T07:10:28.9171171Z",
                                       "endTime":  "2024-03-01T07:10:28.9171171Z",
                                       "originHistoryName":  "08584923298565597836003987229CU207",
                                       "correlation":  {
                                                           "clientTrackingId":  "08584923298565597836003987229CU207"
                                                       },
                                       "status":  "Succeeded"
                                   },
                       "outputs":  {

                                   },
                       "response":  {
                                        "startTime":  "2024-03-01T07:10:28.9171171Z",
                                        "endTime":  "2024-03-01T07:12:28.9171171Z",
                                        "correlation":  {

                                                        },
                                        "code":  "ClientClosedRequest",
                                        "status":  "TimedOut",
                                        "error":  {
                                                      "code":  "ClientClosedRequest",
                                                      "message":  "The connection has been closed by the client while the server is still processing its request. Request tracking id \u002708584923298565597836003987229CU207\u0027."
                                                  }
                                    }
                   },
    "id":  "/subscriptions/xxxxxxxxxxx/resourceGroups/XX-XXX-XX/providers/Microsoft.Logic/workflows/LA-XXXXXXXXX-POC/runs/08584923298565597836003987229CU207",
    "name":  "08584923298565597836003987229CU207",
    "type":  "Microsoft.Logic/workflows/runs"
}, 

"Actions":
{
    "value":  [
                  {
                      "properties":  {
                                         "inputsLink":  {
                                                            "uri":  "https://prod-55.westeurope.logic.azure.com:443/workflows/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/runs/08584923298565597836003987229CU207/actions/Condition/contents/ActionInputs?api-version=2016-10-01\u0026se=2024-04-04T18%3A00%3A00.0000000Z\u0026sp=%2Fruns%2F08584923298565597836003987229CU207%2Factions%2FCondition%2Fcontents%2FActionInputs%2Fread\u0026sv=1.0\u0026sig=lUJRBMXTZXK2X-J-niWqKjK1jhKKMOy0gZW7pDZb_Io",
                                                            "contentVersion":  "VcJgxcEyXSxFSBf+CO4IaA==",
                                                            "contentSize":  25,
                                                            "contentHash":  {
                                                                                "algorithm":  "md5",
                                                                                "value":  "VcJgxcEyXSxFSBf+CO4IaA=="
                                                                            }
                                                        },
                                         "canResubmit":  true,
                                         "startTime":  "2024-03-01T07:13:56.8438876Z",
                                         "endTime":  "2024-03-01T07:13:58.3232409Z",
                                         "correlation":  {
                                                             "actionTrackingId":  "50e86726-67da-4a2b-b64d-63ee0b06a7ca",
                                                             "clientTrackingId":  "08584923298565597836003987229CU207"
                                                         },
                                         "status":  "Failed",
                                         "code":  "ActionFailed",
                                         "error":  {
                                                       "code":  "ActionFailed",
                                                       "message":  "An action failed. No dependent actions succeeded."
                                                   }
                                     },
                      "id":  "/subscriptions/xxxxxxxxxxx/resourceGroups/XX-XXX-XX/providers/Microsoft.Logic/workflows/LA-XXXXXXXXX-POC/runs/08584923298565597836003987229CU207/actions/Condition",
                      "name":  "Condition",
                      "type":  "Microsoft.Logic/workflows/runs/actions"
                  },
                  {
                      "properties":  {
                                         "inputsLink":  {
                                                            "uri":  "https://prod-55.westeurope.logic.azure.com:443/workflows/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/runs/08584923298565597836003987229CU207/actions/Initialize_variable_Method/contents/ActionInputs?api-version=2016-10-01\u0026se=2024-04-04T18%3A00%3A00.0000000Z\u0026sp=%2Fruns%2F08584923298565597836003987229CU207%2Factions%2FInitialize_variable_Method%2Fcontents%2FActionInputs%2Fread\u0026sv=1.0\u0026sig=ki-pG3ElkmY3GGO7XDykUK1_SwP3flJGMicWVwjFEeo",
                                                            "contentVersion":  "8LQjqFxi1kn06CVWRblTBQ==",
                                                            "contentSize":  64,
                                                            "contentHash":  {
                                                                                "algorithm":  "md5",
                                                                                "value":  "8LQjqFxi1kn06CVWRblTBQ=="
                                                                            }
                                                        },
                                         "canResubmit":  true,
                                         "startTime":  "2024-03-01T07:13:54.0050718Z",
                                         "endTime":  "2024-03-01T07:13:54.3965547Z",
                                         "correlation":  {
                                                             "actionTrackingId":  "dd0a7493-9cea-457e-bbbf-22b9cda43607",
                                                             "clientTrackingId":  "08584923298565597836003987229CU207"
                                                         },
                                         "status":  "Succeeded",
                                         "code":  "NotSpecified"
                                     },
                      "id":  "/subscriptions/xxxxxxxxxxx/resourceGroups/XX-XXX-XX/providers/Microsoft.Logic/workflows/LA-XXXXXXXXX-POC/runs/08584923298565597836003987229CU207/actions/Initialize_variable_Method",
                      "name":  "Initialize_variable_Method",
                      "type":  "Microsoft.Logic/workflows/runs/actions"
                  },
                  {
                      "properties":  {
                                         "inputsLink":  {
                                                            "uri":  "https://prod-55.westeurope.logic.azure.com:443/workflows/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/runs/08584923298565597836003987229CU207/actions/Initialize_variable_Querie_RelativePath/contents/ActionInputs?api-version=2016-10-01\u0026se=2024-04-04T18%3A00%3A00.0000000Z\u0026sp=%2Fruns%2F08584923298565597836003987229CU207%2Factions%2FInitialize_variable_Querie_RelativePath%2Fcontents%2FActionInputs%2Fread\u0026sv=1.0\u0026sig=t7EIY1rFWIZ91Scqyr3_e2LltC5vARtXqjt_cyuzsr4",
                                                            "contentVersion":  "LuEj19cQMUxIjDnr48BRjg==",
                                                            "contentSize":  76,
                                                            "contentHash":  {
                                                                                "algorithm":  "md5",
                                                                                "value":  "LuEj19cQMUxIjDnr48BRjg=="
                                                                            }
                                                        },
                                         "canResubmit":  true,
                                         "startTime":  "2024-03-01T07:13:56.1452411Z",
                                         "endTime":  "2024-03-01T07:13:56.1611035Z",
                                         "correlation":  {
                                                             "actionTrackingId":  "07028bc6-925d-4c7c-8f26-6bf52b4459df",
                                                             "clientTrackingId":  "08584923298565597836003987229CU207"
                                                         },
                                         "status":  "Succeeded",
                                         "code":  "NotSpecified"
                                     },
                      "id":  "/subscriptions/xxxxxxxxxxx/resourceGroups/XX-XXX-XX/providers/Microsoft.Logic/workflows/LA-XXXXXXXXX-POC/runs/08584923298565597836003987229CU207/actions/Initialize_variable_Querie_RelativePath",
                      "name":  "Initialize_variable_Querie_RelativePath",
                      "type":  "Microsoft.Logic/workflows/runs/actions"
                  },
                  {
                      "properties":  {
                                         "inputsLink":  {
                                                            "uri":  "https://prod-55.westeurope.logic.azure.com:443/workflows/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/runs/08584923298565597836003987229CU207/actions/Initialize_variable_RelativePath/contents/ActionInputs?api-version=2016-10-01\u0026se=2024-04-04T18%3A00%3A00.0000000Z\u0026sp=%2Fruns%2F08584923298565597836003987229CU207%2Factions%2FInitialize_variable_RelativePath%2Fcontents%2FActionInputs%2Fread\u0026sv=1.0\u0026sig=FN5vPoxPPtXqwUTawZWCCoDD577FBcyISw4b7AsP8k4",
                                                            "contentVersion":  "W0eIKtVYxtDOxh5MrNmeCg==",
                                                            "contentSize":  70,
                                                            "contentHash":  {
                                                                                "algorithm":  "md5",
                                                                                "value":  "W0eIKtVYxtDOxh5MrNmeCg=="
                                                                            }
                                                        },
                                         "canResubmit":  true,
                                         "startTime":  "2024-03-01T07:13:55.433751Z",
                                         "endTime":  "2024-03-01T07:13:55.4482694Z",
                                         "correlation":  {
                                                             "actionTrackingId":  "994cc832-833a-445f-b784-1a9a1c85d9d3",
                                                             "clientTrackingId":  "08584923298565597836003987229CU207"
                                                         },
                                         "status":  "Succeeded",
                                         "code":  "NotSpecified"
                                     },
                      "id":  "/subscriptions/xxxxxxxxxxx/resourceGroups/XX-XXX-XX/providers/Microsoft.Logic/workflows/LA-XXXXXXXXX-POC/runs/08584923298565597836003987229CU207/actions/Initialize_variable_RelativePath",
                      "name":  "Initialize_variable_RelativePath",
                      "type":  "Microsoft.Logic/workflows/runs/actions"
                  },
                  {
                      "properties":  {
                                         "inputsLink":  {
                                                            "uri":  "https://prod-55.westeurope.logic.azure.com:443/workflows/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/runs/08584923298565597836003987229CU207/actions/Response/contents/ActionInputs?api-version=2016-10-01\u0026se=2024-04-04T18%3A00%3A00.0000000Z\u0026sp=%2Fruns%2F08584923298565597836003987229CU207%2Factions%2FResponse%2Fcontents%2FActionInputs%2Fread\u0026sv=1.0\u0026sig=xy7As_2c_drwERNraivg3QTjWkVMm0JiF-EVcF9L6F4",
                                                            "contentVersion":  "pfCJnfA/DmQvDHCg1asiDA==",
                                                            "contentSize":  80,
                                                            "contentHash":  {
                                                                                "algorithm":  "md5",
                                                                                "value":  "pfCJnfA/DmQvDHCg1asiDA=="
                                                                            }
                                                        },
                                         "canResubmit":  true,
                                         "startTime":  "2024-03-01T07:13:57.6536825Z",
                                         "endTime":  "2024-03-01T07:13:57.6548866Z",
                                         "correlation":  {
                                                             "actionTrackingId":  "a8b35cc0-bc78-4fc8-8350-3f14e1fe8bac",
                                                             "clientTrackingId":  "08584923298565597836003987229CU207"
                                                         },
                                         "status":  "Failed",
                                         "code":  "ActionResponseTimedOut",
                                         "error":  {
                                                       "code":  "ActionResponseTimedOut",
                                                       "message":  "The execution of template action \u0027Response\u0027 is failed: the client application timed out waiting for a response from service. This means that workflow took longer to respond than the alloted timeout value. The connection maintained between the client application and service will be closed and client application will get an HTTP status code 504 Gateway Timeout."
                                                   }
                                     },
                      "id":  "/subscriptions/xxxxxxxxxxx/resourceGroups/XX-XXX-XX/providers/Microsoft.Logic/workflows/LA-XXXXXXXXX-POC/runs/08584923298565597836003987229CU207/actions/Response",
                      "name":  "Response",
                      "type":  "Microsoft.Logic/workflows/runs/actions"
                  }
        ]
    }
}

Here, we highlight the most important information, which helps explain what happened during this Logic App execution.

To use this PowerShell script, you need to provide the Resource Group name, the Logic App name, and the target directory for exporting run records. The script saves the results as .json files. PowerShell will prompt you to enter your credentials because it uses the Connect-AzAccount command.

After the script finishes, the exported results will match the provided example. By reviewing the generated files, you can quickly identify the Logic App and determine whether each run succeeded or failed.

sufix status


If you only wish to export and retain failed runs, you can utilize a similar PowerShell script:

I hope this can help you in the future.

Hope you find this helpful! If you enjoyed the content or found it useful and wish to support our efforts to create more, you can contribute towards purchasing a Star Wars Lego for Sandro’s son!

Buy me a coffee
Author: Luis Rigueira

Luis Rigueira is a Enterprise Integration Consultant at DevScope

Leave a Reply

Your email address will not be published. Required fields are marked *

The Ultimate Cloud
Management Platform for Azure

Supercharge your Azure Cost Saving

Learn More
Turbo360 Widget

Back to Top