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:
1 2 3 |
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:
1 2 |
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.
1 2 3 4 |
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:
1 2 3 |
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:
1 2 |
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:
1 2 3 |
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!
Update (25th Nov 2024):
1 2 3 |
resources | where type == 'microsoft.logic/workflows' and properties.accessEndpoint contains '5949a0378a8c44608c737141f9e4bcec' | project name |