I need a powershell script to get the Workflow URL of each workflow in a Azure Standard Logic App. It seems that there is no direct approach to do it using Azure PowerShell, Azure CLI, or even the Azure REST API.
For example, the command:
az logicapp show --name $logicAppName1 --resource-group $resourceGroupName --subscription $subscription
provides only general info.
You can list all the workflows created in a standard logic app by using below REST API. You need to add a Bearer token while invoking this rest api which should have user_impersonation permission.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{LogicAppName}/workflows?api-version=2018-11-01
To get the details of a particular workflow, you can use the given Rest API.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{LogicAppName}/workflows/{workflowName}?api-version=2018-11-01
In order to fetch the workflow url or callback url you can either use Workflows - List Callback Url REST API or the below given PowerShell script which I have referred from here.
$subscription = ‘subscriptionId’
$ResourceGroupName = ‘resourceGroupName’
$LogicAppName = ‘LogicAppName’
$workflowName = ‘workflowName’
$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/$workflowName/triggers/When_a_HTTP_request_is_received/listCallbackUrl?api-version=2018-11-01
$callbackUrl = ($workflowDetails | ConvertFrom-Json).value
Write-Host "The Workflow URL is: $callbackUrl"