0
votes

We have a CI/CD setup for the deployment of Logic Apps using ARM templates. There are around 20 logic apps we have parameterized and checked in as templates in our code (both template.json and parameters.json) files, and then we can deploy them using our pipelines to any environment we want.

The question I want to ask is how to check/verify the ARM templates after making changes to the Logic Apps. For now what we are doing is editing the logic apps using the designer in azure portal in one of the dev environments and then manually copy and pasting the updated part in the template.json file.

I was wondering if there is a better approach we can take to verify the manually updated template.json files, since we only come to know about an error in the template when we try to deploy it. Also it would be better to have a way to visualize the logic app ARM template using some designer if possible to check all the steps.

I know we have an extension for visual studio that allows you to design and deploy logic app ARM template in the editor itself, but I am unable to find a way to open already existing templates in the visual studio logic app designer, since we only want to update and verify the template in the designer, the deployment is handled by pipelines.

Please let me know if there is a better approach to locally verify/test the logic app ARM templates.

1

1 Answers

0
votes

For now what we are doing is editing the logic apps using the designer in azure portal in one of the dev environments and then manually copy and pasting the updated part in the template.json file.

You can use the LogicAppTemplate module in powershell to get the template from your subscription. That way you don't have to copy paste the changed components.

but I am unable to find a way to open already existing templates in the visual studio logic app designer, since we only want to update and verify the template in the designer, the deployment is handled by pipelines.

As I understand, there is no way of importing a template.json for a logic app in Visual Studio or Visual Studio Code. And the only way to view it in designer would be to publish it first. However, if you convert the template.json into a bicep file, Visual Studio Code can validate the converted .bicep file.

To generate the template.json for the existing logic app:

$parameters = @{
 Token = (az account get-access-token | ConvertFrom-Json).accessToken
 LogicApp = '<logicapp_name>'
 ResourceGroup = '<resourceGroupName'
 SubscriptionId = "Subscription_ID"
 Verbose = $true
}

Get-LogicAppTemplate @parameters | Out-File temp.json

and then you convert it with the following command:

bicep decompile temp.json

Now we load up the generated bicep file in visual studio code for validation. For instance:

bicep validation in VS Code