Enterprise Logic App ARM Template Deployment through PS

We had a requirement for automating integration platform deployment for my customer. The integration layer mainly consists of Logic Apps and azure resources.

The challenge was the number of environments we had. So we came up with the solution structure for different integrations as below. And then utilized our below automation script to deploy these logic apps through PowerShell.

PowerShell Script

# Login to Azure
Login-AzureRmAccount

# Select Subscription
$sub = ’94xxyy9a-e0e4-4d04-a1df-54d091b9665c’
Select-AzureRmSubscription -SubscriptionId $sub

# Resource Group Name
$ResourceGroupName = “rg-aue-ms-dev”

# Environment Name
$env = ‘MS-DEV’

# Project Name
$path = “C:\FLVSTS\D5\Non-native\Address Validation\FBS.Intgeration.ESAM\FBS.Intgeration.ESAM”

# Extract the name
$name = (Get-ChildItem -path $path *.json).Name

# Deploy each Logic App
foreach($TemplateName in $name)
{
$TemplateName = $TemplateName.Split(‘.’)[0]
$TemplateFile = $path+’\’+”$TemplateName.json”
$TemplateParamFile = $path+’\’+$env+’\’+”$TemplateName.parameters.json”
New-AzureRmResourceGroupDeployment -Name (‘ARM-Deployment’ + ‘-‘ + ((Get-Date).ToUniversalTime()).ToString(‘HH-mm-ss’)) `
                                -ResourceGroupName $ResourceGroupName `
                                -TemplateFile $TemplateFile `
                                -TemplateParameterFile $TemplateParamFile `
                                -Force -Verbose `
                                -ErrorVariable ErrorMessages

}

This was implemented during initial phase of the project. Later we utilized ARM Linked template feature coupled with Azure DevOps to automate this completely. Will cover this as part of another blog.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s