21.03.2019

Updating Azure Logic App parameters with Powershell

Haven’t really needed to change Logic App parameters without doing a new deployment earlier, but now I had an interesting problem.

I tried to create my first recursive Logic App. Naturally at that point had forgotten that I can solve my problem also with do-while-loop, so recursion is not the main point here – the Logic App’s parameter setting without running ARM deployment is – if you’re interested more in recursion, here are a couple of good posts by Vincent-Philippe Lauzon and François Boucher.

I did my experiment with the latter post’s Method 2 – calling the same Logic App directly with HTTP action pointing to own request URL. You can manually add the URL easily, but how to deploy a new instance with ARM template where circular references are not allowed and listCallbackUrl function is not working…

So the workflow without correct URL is here – it would be easy to save and copy the value from request trigger, but that’s not a way to automate deployment. (Remember to make sure your recursion really works correctly before actually executing it…)

If I try to deploy this from an ARM template that would try get own CallbackUrl like this:

It would only fail miserably:

So, go with parameters…create a Logic App parameter with a placeholder value:

Logic App look now like this:

 

After deployment, Powershell solves the rest:

  1. Get original settings:

    $lapp = Get-AzureRmLogicApp -ResourceGroupName TempLA -Name RecursiveArmTest

  2. Get deployed Logic App’s callback url:

    $newurl = Get-AzureRmLogicAppTriggerCallbackUrl -ResourceGroupName TempLA -Name RecursiveArmTest -TriggerName request

  3. Set Logic App parameter value to deployed callback url from previous step:

    $lapp.Parameters[‘plaSelfUrl’].Value = $newUrl.Value

  4. Update Logic App:

    Set-AzureRmLogicApp -ResourceGroupName TempLA -Name RecursiveArmTest -Parameters $lapp.Parameters

And that’s it – easy to set in your pipeline too (you could actually get the callbackUrl as an output from deployment too without separate PS command). And seemed to work:

The best part of this is that you don’t have to run an ARM template deployment to change those Logic App parameters – which might be very useful for example in updating some API keys in multiple Logic Apps etc…Didn’t find any post around the topic, so maybe this helps someone else too.

ARM templates can be downloaded from this link.

Share
Contact Person

Blog writer

Esa Vanhanen-Varho

Integration Architect

Vincit Bilot

Bilot & Vincit have joined forces!

See where the story continues 

You have Successfully Subscribed!

Vincit Bilot

Bilot & Vincit have joined forces!

See where the story continues 

You have Successfully Subscribed!