Finding the link to a Logic App workflow run

(Note: Read till the end of this post…)

A colleague told me that if I want to link to the particular run of a Power Automate run I can use the following:

That is super useful! Often I have to dig around in the history of my Flows to find a particular problem instance, but with this I could simply include this as a Url in the error email I send users.

Anyways, I work more on Logic Apps than Flows so I wanted to find the same for that. Turns out the workflow() method is common to both Logic Apps and Power Automate so I could maybe reuse that.

First off, what does the Url to a Logic App workflow run look like? It looks like this:<subscriptionId>%2FresourceGroups%2F<resourceGroup>%2Fproviders%2FMicrosoft.Logic%2Fworkflows%2F<logicAppName>%2Fruns%2F<runId>

So essentially I need to get the details in bold and I can concatenate it with the rest to create the Url. I decided to look into workflow() to see what I can gather. I know I can get the <runId> from workflow() but what about the rest? Turns out it is super easy.

I made a dummy logic app like thus:

Ran it, and I got what workflow() looks like:

Sweet! So the workflow() property actually has everything I need. I was thinking it might just be the <runId> but I was mistaken. Nice!

So I took a stab at creating my Url by defining a variable like this: concat('',workflow()

On paper it looks like it should work but it didnt. I got the following error:

Huh. The Url clearly has runid. Heck, even the error message shows that.

One thing is this when I look at the Url from the Portal for a run it has all the / characters encoded as %2F. Maybe I need to do the same?

Thus: concat('', encodeUriComponent(workflow()

That didn’t work either. Same error as above. But I noticed that the Url now has ...runid%2Fsubscriptions...  while the Url from the portal was runid/%2Fsubscriptions (notice the additional /).

So I modified my expression once more to add a / after runid: concat('', encodeUriComponent(workflow() whoo hoo that worked! So that’s the equivalent for Logic Apps. :)

To summarize:

  • For Logic Apps the Url is concat('', encodeUriComponent(workflow()
  • For Power Automate it is concat('', workflow().tags.environmentName, '/flows/', workflow().name, '/runs/', workflow() (you will need to replace canada with wherever your environment is hosted)

Update (15th March 2022): I noticed today that the Urls generated for my Logic Apps are broken. For instance, here’s one I got: I know the bit in bold is the actual id of that run, but notice how the Url doesn’t have the subscription, resource group, or logic app name any more. Something’s changed.

I double checked by creating a new Logic App with just workflow() and yes the output is different. I am not imagining this, when I Google I found another blog post where the person had the same output as I had in the past – subscription, resource group, etc. So I am thinking something’s broken currently or there’s been a change since last week when I posted the above.

As of now I don’t have a way to get the full Url for Logic Apps. But it might have changed by the time anyone reads this post.