Created
June 4, 2024 14:08
-
-
Save matejskubic/b0dc2ffc24dc9e7302ae2394b9a3cbb3 to your computer and use it in GitHub Desktop.
Get Logic App Standard workflow trigger url
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<fragment> | |
<choose> | |
<when condition="@(null != context.Variables.GetValueOrDefault<string>("LaWfName", null))"> | |
<cache-lookup-value key="@(context.Variables.GetValueOrDefault<string>("LaWfName", null))" variable-name="LAWfTriggerUri" caching-type="internal" /> | |
<choose> | |
<when condition="@(string.IsNullOrEmpty(context.Variables.GetValueOrDefault<string>("LAWfTriggerUri", null)))"> | |
<send-request mode="new" timeout="20" ignore-error="false" response-variable-name="LAWfTriggerResponse"> | |
<set-url>@{ | |
var laName = context.Variables.GetValueOrDefault<string>("LaName", null); | |
var laWfName = context.Variables.GetValueOrDefault<string>("LaWfName", null); | |
return $"https://management.azure.com{{LAResoureGroupId}}/providers/Microsoft.Web/sites/{laName}/hostruntime/runtime/webhooks/workflow/api/management/workflows/{laWfName}/triggers/manual/listCallbackUrl?api-version=2022-03-01"; | |
}</set-url> | |
<set-method>POST</set-method> | |
<!-- Requires Logic Apps Standard Operator role --> | |
<authentication-managed-identity resource="https://management.azure.com/" /> | |
</send-request> | |
<set-variable name="LAWfTriggerBody" value="@(((IResponse)context.Variables["LAWfTriggerResponse"]).Body.As<JObject>())" /> | |
<set-variable name="LAWfTriggerUri" value="@(context.Variables.GetValueOrDefault<JObject>("LAWfTriggerBody", null)?["value"]?.ToString())" /> | |
<cache-store-value key="@(context.Variables.GetValueOrDefault<string>("LaWfName", null))" value="@(context.Variables.GetValueOrDefault<string>("LAWfTriggerUri", null))" duration="300" caching-type="internal" /> | |
</when> | |
</choose> | |
<set-backend-service base-url="@((new Uri(context.Variables.GetValueOrDefault<string>("LAWfTriggerUri", null))).GetLeftPart(UriPartial.Authority))" /> | |
<rewrite-uri template="@((new Uri(context.Variables.GetValueOrDefault<string>("LAWfTriggerUri", null))).PathAndQuery)" /> | |
</when> | |
</choose> | |
</fragment> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment