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: https://portal.azure.com/#blade/Microsoft_Azure_EMA/LogicAppsMonitorBlade/runid/%2Fsubscriptions%2F<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().run.id 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().run.id 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('https://portal.azure.com/#blade/Microsoft_Azure_EMA/LogicAppsMonitorBlade/runid',workflow().run.id)

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('https://portal.azure.com/#blade/Microsoft_Azure_EMA/LogicAppsMonitorBlade/runid', encodeUriComponent(workflow().run.id))

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('https://portal.azure.com/#blade/Microsoft_Azure_EMA/LogicAppsMonitorBlade/runid/', encodeUriComponent(workflow().run.id))And whoo hoo that worked! So that’s the equivalent for Logic Apps. :)

To summarize:

  • For Logic Apps the Url is concat('https://portal.azure.com/#blade/Microsoft_Azure_EMA/LogicAppsMonitorBlade/runid/', encodeUriComponent(workflow().run.id))
  • For Power Automate it is concat('https://canada.flow.microsoft.com/manage/environments/', workflow().tags.environmentName, '/flows/', workflow().name, '/runs/', workflow().run.name) (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: https://portal.azure.com/#blade/Microsoft_Azure_EMA/LogicAppsMonitorBlade/runid/%2Fworkflows%2Fb2f4aba8777a11ecb6f150435ebfde4d%2Fruns%2F08585542572052667419360195419CU17. 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.