Using Azure DevOps Pipeline to handle a system maintenance window with Logic Apps

The architectural pattern here is not just โ€œturn things off and on.โ€ It is a controlled operational switch for integration workloads that behave differently under maintenance pressure: queue-driven Logic Apps can absorb backlog, while polling workflows can be paused to avoid failed calls and noisy retries. For teams running mixed integration styles, the practical value is having one repeatable control plane for both categories instead of ad hoc manual intervention.

A pipeline-based toggle also changes how maintenance is governed. By wrapping the state change in Azure DevOps, access becomes auditable, repeatable, and available to support staff without requiring each operator to know the underlying Azure commands. That matters in incident-prone windows, where speed, role clarity, and a minimal runbook reduce the chance of missed steps or inconsistent application states across environments.

The PowerShell approach introduces a small but important dependency model. The script must know the target resource group, the set of Logic Apps to manage, and the Azure management API path used to enable or disable each workflow. That makes the solution simple to extend, but it also means configuration drift is a real operational concern if new interfaces are added without updating the list. Treating the script as part of the integration estate helps keep lifecycle management aligned with deployment changes.

From a reliability perspective, the design trades live availability for controlled recovery. Queue-backed processes can defer work, but polling integrations need a defined catch-up strategy after reactivation. Teams adopting this pattern should consider what backlog is acceptable, how long resumption may take, and whether dependent systems can tolerate delayed synchronization. In practice, the pipeline becomes a lightweight orchestration layer for planned downtime, not just a deployment tool.


This weekend one of the systems we integrate with had a maintenance window while some server upgrades were performed. To support this activity we needed to be able to take some of our Logic App integrations off line during the maintenance window. Our design patterns for integration fall into a couple of patterns with respect to this system:
  1. Logic Apps which listen to a service bus queue then call APIโ€™s to upload data to the system
  2. Logic Apps which run on a schedule and poll the system APIโ€™s and download data for various other interfaces
These approaches are easy for us to handle a maintenance window. We can simply disable the interfaces then re-enable them. Any messages on service bus will just queue up and be handled later. The polling interfaces will just catchup when ready. To implement the disable/enable we setup a DevOps pipeline so anyone on the team could run the job when needed. We used the Azure Powershell task in DevOps configured like below which will call a script in a repo to do the necessary actions. I just pass in the resource group and desired state as parameters.
steps:
- task: AzurePowerShell@4
  displayName: 'Enable Logic Apps'
  inputs:
    azureSubscription: 'Mikes-Subscription'
    ScriptPath: '$(System.DefaultWorkingDirectory)/_Admin/Interfaces.ChangeState.ps1'
    ScriptArguments: '-resourceGroup ''Mikes-ResourceGroup'' -desiredState ''Enabled'''
    azurePowerShellVersion: LatestVersion

We then just had a classic release pipeline which has a stage for our UAT and Prod environments and one to disable and one to enable. This makes it easy for whoever is on support and in the future we just need to add any interfaces to the powershell The script below contains a list of logic apps to pause and enable depending on the parameters provided.

param (
    # The resource group to update
    [string]$resourceGroup = "", 
    
    # Enabled or Disabled
    [string]$desiredState = ""    
)


$logicApps = New-Object "System.Collections.Generic.List[System.String]" 

# Material Reservation
$logicApps.Add('Mikes-LogicApp-1')
$logicApps.Add('Mikes-LogicApp-2')
$logicApps.Add('Mikes-LogicApp-3')
$logicApps.Add('Mikes-LogicApp-4')


# Helper Function to change the state of the logic app
function ChangeLogicAppState([string] $logicAppName, [string] $resourceGroupName, [string] $desiredState)
{
    Write-Host 'Checking logic app ' $logicAppName

    $logicApp = Get-AzLogicApp -ResourceGroupName $resourceGroupName -Name $logicAppName
    Write-Host ($logicApp | Format-List | Out-String)
        
    $apiOperation = 'unknown'
    if($desiredState -eq 'Enabled')
    {
        $apiOperation = 'enable'    
    }
    elseif($desiredState -eq 'Disabled')
    {
        $apiOperation = 'disable'
    }
        
    if($logicApp -eq $null)
    {
        Write-Host 'Logic App does not exist: ' $logicAppName
    }
    else
    {
        Write-Host 'Logic App does exist: ' $logicAppName

        $currentState = $logicApp.State.ToLower()        
        if($currentState -eq $desiredState.ToLower())
        {
            Write-Host 'Logic App ' $logicApp.Name ' is already in the desired state'
        }
        else
        {
            $url = 'https://management.azure.com/' + $logicApp.Id + '/' + $apiOperation + '?api-version=2016-06-01'
            $response = az rest --method post --uri $url 
            Write-Host 'Logic App Changed'

            $logicApp = Get-AzLogicApp -ResourceGroupName $resourceGroupName -Name $logicAppName
            Write-Host ($logicApp | Format-List | Out-String)
        } 
                       
    }
}

#Loop through the Logic App workflows and change their state
foreach($logicApp in $logicApps){
    ChangeLogicAppState -logicAppName $logicApp -resourceGroupName $resourceGroup -desiredState $desiredState    
}





The post Using Azure DevOps Pipeline to handle a system maintenance window with Logic Apps appeared first on Microsoft Integration & Cloud Architect.
Using Azure DevOps Pipeline to handle a system maintenance window with Logic Apps was first posted on February 13, 2023 at 2:36 pm.
ยฉ2019 “Microsoft Integration & Cloud Architect“. Use of this feed is for personal non-commercial use only. If you are not reading this article in your feed reader, then the site is guilty of copyright infringement. Please contact me at [email protected]
Original Post

Enjoyed this article? Sign up for our newsletter to receive regular insights and stay connected.