If you are developing Logic Apps on ISE or Consumption then you will know when you deploy them you will often see the below error message.

Because the Az modules have all the capabilities of AzureRM modules and more, we will retire the AzureRM modules on 29 February 2024

Microsoft are focused on Logic App Standard at the moment and there hasnt been any updates to the Logic App add in for Visual Studio for a while.

With this in mind we have decided to take a pre-emptive step and modify the Powershell file that the Visual Studio add in used to do a deployment.

If you do a deployment by visual studio then it will copy your files to a directory within the staging directory then run the Powershell script which basically does an overly complicated bunch of stuff to do your deployment. Since the Az Powershell modules you can do New-AzResourceGroupDeployment and just pass the 2 arm templates and its loads simpler.

By simply replacing the script with our script below you can just run the script directly in Powershell or alternatively you can still do a right click + Deploy in Visual Studio and it will still do the deployment but just using the updated script.

When we come to deploy to other environments we are using the Azure DevOps ARM deployment task anyway do this doesnt really apply but if your deploying to your dev environment from your dev machine this might save you some grief next year.

The script we are using is below:


#Use Connect-AzAccount to connect to Azure in Powershell before running this
#Connect-AzAccount

$subscriptionId = '{Mikes-Sub}'
$deploymentName = '{A Name you want to give your deployment}' 
$location = 'westus2'
$resourceGroupName = '{Your resource group}'

Set-AzContext -SubscriptionId $subscriptionId

$currentDirectory = $PSScriptRoot
$TemplateFile = $currentDirectory + '\LogicApp.json'
$TemplateParametersFile = $currentDirectory + '\LogicApp.parameters.json'


#Do Logic App Deployment
Write-Host 'Deploying Logic Apps'
$deploymentStartDate = Get-Date -Format "yyyyMMddHHmmss"
$deploymentFullName = $deploymentName + '_' + $deploymentStartDate

New-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateFile $TemplateFile -TemplateParameterFile $TemplateParametersFile -Name $deploymentFullName -SkipTemplateParameterPrompt

 

Buy Me A Coffee