0
votes

I have a azure logic app designed at my end with some many connectors and loops and conditions like Sending email,SQL update and other set of things.

The flow gets executed properly as per my requirement and provides me the end result.

Now what i want is to get all the steps or actions performed in a particular logic app run to be retrieved at one shot along with status. Let me explain my query by taking a small example of logic app:

Let assume there is a logic app 5 steps with Name as TestLogicAPP and it has following actions or steps in it:

STEP 1: Flow is triggered when email is received : The connector used in OFfice365 STEP 2: After the flow is triggered first action is marking it as read: again connector used is Office365 STEP 3: Sending a reply to the sender: again connector used is Office365 STEP 4: Assume there is a attachment coming in email, and Storing attachment name in a variable by declaring a variable Using inbuilt variable deceleration
STEP 5: Storing this attachment received in email into Azure File storage or file share: Used azure file storage connector

All these steps are executed in logic apps perfectly without any errors when you the run history.

What i want is to list all these actions/steps at one go with its status like

STEP1 name : Successful STEP2 name : Successful STEP3 name : Failed along with failed reason or message(assuming 3rd is failed from above given example)

Or

STEP1 name : Successful STEP2 name : Successful STEP3 name : Successful STEP4 name : Successful STEP5 name : Successful

For this When i searched web i got a a rest API provided by Microsoft that gives these details:

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions?api-version=2016-06-01

Above API Taken from below link: https://docs.microsoft.com/en-us/rest/api/logic/workflowrunactions/list#code-try-0

But when executed it is not listing all the actions in a given logic app run. To be specific it is not listing below connector related actions:

  1. Trigger action of logic app(office 365 connector)
  2. Sending email (office 365 connector)
  3. Uploading attachment file in email to Azure file share or file storage

Note sure why? Is it a bug in Microsoft Logic APP REST API or is it built to display or omit these type of steps or actions purposefully?

Or Is there any other way to get the desired result explained above?

Please help me regarding this issue or query.

Searched web and found the Logic app related rest API from below link as described above.

Expected Result: Get all actions or step results of a logic app run including the trigger action

Actual Result: Getting only few actions/steps result few are getting omitted from the rest api result.

1

1 Answers

0
votes

May I know how did you call the rest api ? I test it and get the expected results, post the steps as below for your reference:

  1. I created a logic app in my azure portal(shown as screenshot below) enter image description here

  2. Send an email to the email address to trigger this logic app.

  3. In the run history of my logic app, it shows as below screenshot. The action "Mark as read or unread" is failed and the last action was skipped. enter image description here

  4. Then I went to the page of the rest api you provided: https://docs.microsoft.com/en-us/rest/api/logic/workflowrunactions/list and click "Try it". Input all of the params which are required such as "resourceGroupName", "workflowName" and "runName". enter image description here

  5. After click "Run", the result show as below:

{
  "value": [
    {
      "properties": {
        "inputsLink": {
          "uri": "xxxxxxxxx",
          "contentVersion": "xxxxxxx",
          "contentSize": 377,
          "contentHash": {
            "algorithm": "md5",
            "value": "xxxxxx"
          }
        },
        "outputsLink": {
          "uri": "xxxxxxxx",
          "contentVersion": "xxxxxxx",
          "contentSize": 766,
          "contentHash": {
            "algorithm": "md5",
            "value": "xxxxxxx"
          }
        },
        "startTime": "2019-10-28T06:17:56.8609023Z",
        "endTime": "2019-10-28T06:17:56.9044006Z",
        "correlation": {
          "actionTrackingId": "xxxxxxx",
          "clientTrackingId": "xxxxxxx"
        },
        "status": "Failed",
        "code": "BadRequest"
      },
      "id": "/subscriptions/xxxxxxx/resourceGroups/huryTest/providers/Microsoft.Logic/workflows/hurylogicsteps/runs/xxxxxx/actions/Mark_as_read_or_unread_(V2)",
      "name": "Mark_as_read_or_unread_(V2)",
      "type": "Microsoft.Logic/workflows/runs/actions"
    },
    {
      "properties": {
        "startTime": "2019-10-28T06:17:56.9859119Z",
        "endTime": "2019-10-28T06:17:56.9977121Z",
        "correlation": {
          "actionTrackingId": "xxxxxx",
          "clientTrackingId": "xxxxxx"
        },
        "status": "Skipped",
        "code": "ActionSkipped",
        "error": {
          "code": "ActionConditionFailed",
          "message": "The execution of template action 'Send_an_email_(V2)' is skipped: the 'runAfter' condition for action 'Mark_as_read_or_unread_(V2)' is not satisfied. Expected status values 'Succeeded' and actual value 'Failed'."
        }
      },
      "id": "/subscriptions/xxxxxx/resourceGroups/huryTest/providers/Microsoft.Logic/workflows/hurylogicsteps/runs/xxxxxx/actions/Send_an_email_(V2)",
      "name": "Send_an_email_(V2)",
      "type": "Microsoft.Logic/workflows/runs/actions"
    }
  ]
}

We can see there are two actions under "values" in the response body in json type. The status of "Mark_as_read_or_unread_(V2)" is "Failed" and the status of "Send_an_email_(V2)" is "Skipped". Although they failed or skipped, but both of them are shown in the result of this rest api.(in your question, you said "Sending email" is not list in the result)

By the way: As far as I know, this api just shows the actions, but the trigger is not an action. So the trigger will not show in the result of this api.

Apart from this, if we don't use the rest api, we can also see all of the status of the action in azure portal by "Runs history" --> "Run Details"

Hope it would be helpful to your problem~