Quantcast
Channel: rakhesh – rakhesh.com
Viewing all articles
Browse latest Browse all 742

Finding a Logic App name from its workflow Id

$
0
0

I had a Logic App Url from a colleague. This was a Logic App invoked via HTTP, so the Url I had looked something like this: https://prod-01.canadacentral.logic.azure.com:443/workflows/90ca8fb8e1fa4c58b1847a84dd61cdea/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=38--282Z2cLJPcJr-af02wVnok2MCLruPevea9rvwYM

(No, this is not the real Url… I changed the key and workflow Id etc.)

From the Url I know what the workflow Id is – it’s the bit I highlighted. So how do I find the Logic App name from that? I tried putting that Id in the Logic Apps search field and got nothing, so that doesn’t help.

Then I remembered my new friend Azure Resource Graph. :) So I fired up the Resource Graph Explorer in Azure Portal.

From the Starter query examples page I know that you can run queries like these to get a count of all Key Vaults, for instance:

Resources
| where type =~ 'microsoft.keyvault/vaults'
| count

So the first thing I need is the type of Logic Apps. I could Google that I suppose, but I also want to learn the Kusto language for Resource Graph queries, so I came up with the following:

Resources
| project type | distinct  type

This gives me a list of all the types in my subscriptions. Example:

I scrolled through this list as you can see above and found microsoft.logic/workflows which sounds like what I want.

However, I was curious if I can use some sort of regex to narrow this further instead of having scrolled. Found this example in another page that shows the use of regex.

Resources
| where type =~ 'microsoft.compute/virtualmachines' and name matches regex @'^Contoso(.*)[0-9]+$'
| project name
| order by name asc

Ok, so one specifices the regex in the single quotes that follow the @ above. So we can do:

resources
| project type | distinct  type 
| where type matches regex @'logic'

Nice!

Ok, so now how do I search for the workflow Id?

First let’s find out what properties are returned. For that I’ll get one of these Logic App workflows:

resources
| where type =~ 'microsoft.logic/workflows' | limit 1

If I look at the details of the result, I don’t see anything that contains a workflow Id as such. The closest seems to be the accessEndpoint property. This contains a Url of the form: https://prod-10.canadacentral.logic.azure.com:443/workflows/<workflowId>. The prod10-canadacentral bit too varies am sure depending on the location. But the key thing is I can use this to search for the Id I have. Based on the Url I pasted at the top of this post, I have to search for https://prod-01.canadacentral.logic.azure.com:443/workflows/90ca8fb8e1fa4c58b1847a84dd61cdea.

So we do:

resources
| where type == 'microsoft.logic/workflows' and properties.accessEndpoint == 'https://prod-01.canadacentral.logic.azure.com:443/workflows/90ca8fb8e1fa4c58b1847a84dd61cdea'
| project name

And that gives us the name!


Viewing all articles
Browse latest Browse all 742

Trending Articles