Recently I've been researching on Azure components, especially using Logic App (single-tenant) and its deployment automation using Azure bicep. One roadblock I faced was retrieving the callback URLs of the workflows inside the Logic App.
It's pretty easy to retrieve the callback URL of a workflow of Logic App (multi-tenant), since practically they're the same thing. The code below retrieve the callback URL of a workflow:
listCallbackURL('${logicAppWorkflow.id}/triggers/manual', '2017-07-01').value
Logic App (single-tenant) on the other hand, is a different beast altogether. A single Logic App (single-tenant) can house many different workflows. I've been searching around in Microsoft's documentation, in forums to no avail. Finally I got the hint from stackoverflow post here where user ibda provided the REST API sample below:
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/manual/listCallbackUrl?api-version=2018-11-01
Essentially, with the above sample we can just call the function as follows:
listCallbackUrl('${logicAppStd.id}/hostruntime/runtime/webhooks/workflow/api/management/workflows/${workflowName}/triggers/manual', '2018-11-01')
Top comments (3)
Include "value" at the end
E.G
output test01 string = listCallbackUrl('${logicAppMain.id}/hostruntime/runtime/webhooks/workflow/api/management/workflows/${logicAppWorkflowName}/triggers/When_a_HTTP_request_is_received', '2018-11-01').value
Full bicep:
targetScope = 'subscription'
// ------------ parameters -----------
@description('Name of the logic app')
param logicAppName string
@description('Name of the logic app WorkFlow')
param logicAppWorkflowName string
@description('Resource group name')
param resourceGroupName string
// ------------ resource references -----------
resource logicAppMain 'Microsoft.Web/sites@2021-01-15' existing = {
name: logicAppName
scope: resourceGroup(resourceGroupName)
}
//This line disables warnings.(#disable-next-line outputs-should-not-contain-secrets)
disable-next-line outputs-should-not-contain-secrets
output test string = listCallbackUrl('${logicAppMain.id}/hostruntime/runtime/webhooks/workflow/api/management/workflows/${logicAppWorkflowName}/triggers/When_a_HTTP_request_is_received', '2018-11-01').value
thanks, this is very helpful, there is no Microsoft document give us this api