Archive | janvier 24, 2022

Retrieve Logic Apps (standard) Workflow URL with Powershell

I was looking how to get a Logic Apps workflow url to automate an Event Grid subsciption with Webhook and I came across this great article from  Mike Stephenson.

Unfortunately, this only works for Logic Apps Consumption. The aim of this article is to share the way to get the workflow URL for Logic Apps Standard. To learn more about Logic Apps Standatd : Link1

The following PS use the management API to return the workflow url:

$subscription = 'your subscription ID'
$ResourceGroupName = 'your RG name'
$LogicAppName = 'your Logic Apps name'
$MyWorkflow = 'your workflow name'


$workflowDetails = az rest --method post --uri https://management.azure.com/subscriptions/$subscription/resourceGroups/$ResourceGroupName/providers/Microsoft.Web/sites/$LogicAppName/hostruntime/runtime/webhooks/workflow/api/management/workflows/$MyWorkflow/triggers/When_a_resource_event_occurs/listCallbackUrl?api-version=2018-11-01


Write-Host $workflowDetails
            

NB: in my case I’m using Event Grid trigger « When_a_resource_event_occurs », this is to be changed for other trigger.

this call retrun the following json result :

to parse the json result and return only the the workflow url :

$url = ($workflowDetails | ConvertFrom-Json).value
Write-Host $url

Hope this can help!!!