Blog Post

Azure Integration Services Blog
4 MIN READ

Bulk-configure diagnostic settings on Azure Logic Apps Consumptions

Yanbo_Deng's avatar
Yanbo_Deng
Icon for Microsoft rankMicrosoft
May 20, 2026

If you've ever stared at a resource group with 100+ Consumption Logic Apps and been told "make sure all of these send logs to Log Analytics by Friday", you already know the problem: the Azure Portal makes you click into each Logic App, hit Diagnostic settings -> Add, fill in the same form, and save -- once per Logic App. It's tedious, error-prone, and silently overwrites an existing setting if you reuse a name.

Bulk-configure diagnostic settings on Azure Logic Apps — without clicking through the Portal

LA-BulkDiag is a small, single-file PowerShell script that does the whole job in one guided run. It enumerates every Consumption Logic App in a resource group, shows you which ones already have settings, lets you pick a scope (every bare LA / every LA / a hand-picked subset), and creates the diagnostic setting on each. It auto-renames on collision so re-running is safe, and it ships with 129 Pester tests covering helpers, parameter binding, and end-to-end flows with a mocked az.

Source + full docs: 

GitHub - dengyanbo/LA-BulkDiag: Bulk diagnostics configuration for Azure Logic Apps

What it gives you

  • A numbered, color-coded table of every Consumption LA in the RG and its current diagnostic-setting state (bare / has N / list failed).
  • A single scope prompt — bare / all / pick / cancel — so the common cases are one keystroke.
  • Selection grammar for the picker / -Selection: 1,3-5,8, bare, all, none.
  • Auto-rename on name collision (la-diag → la-diag-1 → …) so the upsert behavior of Azure’s API never silently replaces an existing setting.
  • Preflight verification of the destination workspace / storage account via az resource show before touching any Logic App.
  • -WhatIf for a dry-run preview.
  • Non-zero exit code if any LA failed, so it composes cleanly in CI.

What it is not: it does not target Standard Logic Apps (Microsoft.Web/sites with kind=workflowapp) — those use a different API. It also doesn’t target Event Hub destinations. For everything else, see the “Scope and what this is NOT” section in the GitHub README.

Quick start

Prerequisites

  • PowerShell 5.1+ (Windows PowerShell or PowerShell 7 — both fine).
  • Azure CLI on PATH: https://aka.ms/installazurecliwindows
  • An interactive az login against the subscription that owns the Logic Apps. Built-in Monitoring Contributor on the RG is enough.

Get the script

 
git clone https://github.com/dengyanbo/LA-BulkDiag.git
cd LA-BulkDiag

One-liner — fully interactive

You don’t need to know the destination IDs up front; the script will ask:

 
.\Set-LogicAppDiagnostics.ps1 -ResourceGroup my-rg -SettingName la-diag
 

You’ll see something like:

 
Sub: my-sub (00000000-...)  User: alice@contoso.com

Destination not provided on the command line. Configure interactively:
  (paste the full ARM resource ID; leave blank to skip a destination)
Log Analytics workspace resource ID: /subscriptions/.../workspaces/my-ws
Storage account resource ID:

Inspecting 3 Logic App(s) ...

Logic Apps in 'my-rg':
  [ 1] order-processor             bare (no settings)
  [ 2] notification-sender         has 1: corp-governance
  [ 3] data-loader                 bare (no settings)

How do you want to apply 'la-diag'?
  1) bare -- apply to every BARE LA (recommended)
  2) all  -- apply to EVERY LA (may fail Azure-side on non-bare ones)
  3) pick -- go into the selective picker
  0) cancel
Choice [1]: 1
Applying to every BARE LA.

==> order-processor
  Creating ...
  OK (Created).
==> data-loader
  Creating ...
  OK (Created).

================ Summary ================

LogicApp        FinalName Status
--------        --------- ------
order-processor la-diag   Created
data-loader     la-diag   Created

Selected: 2  Succeeded: 2  Renamed: 0  Failed: 0  Not selected: 1
 

That’s the whole workflow.

The commands you’ll actually use

Grab the destination IDs once:

$wsId = az monitor log-analytics workspace show -g ws-rg -n my-ws --query id -o tsv
$saId = az storage account show -g sa-rg -n mysa --query id -o tsv

1. Apply to every bare LA — fully automated

 
.\Set-LogicAppDiagnostics.ps1 -ResourceGroup my-rg `
    -WorkspaceId $wsId -SettingName la-diag -Selection bare

-Selection bare skips both the scope prompt and the y/N confirm — perfect for CI.

2. Send to both a workspace and a storage account

 
.\Set-LogicAppDiagnostics.ps1 -ResourceGroup my-rg `
    -WorkspaceId $wsId -StorageAccountId $saId `
    -SettingName la-diag -Selection all

3. Metrics only, storage-only

 
.\Set-LogicAppDiagnostics.ps1 -ResourceGroup my-rg `
    -StorageAccountId $saId -SettingName la-metrics `
    -Preset metrics-only -Selection all

Available presets: all (default) / logs-only / metrics-only / workflowruntime.

4. Specific Logic Apps by index — non-interactive

After running once and seeing the numbered table, you can target them directly:

.\Set-LogicAppDiagnostics.ps1 -ResourceGroup my-rg -WorkspaceId $wsId `
    -SettingName la-diag -Selection '1,3-5,8'

5. Dry-run before committing

 
.\Set-LogicAppDiagnostics.ps1 -ResourceGroup my-rg -WorkspaceId $wsId `
    -SettingName la-diag -Selection all -WhatIf

6. Just inspect — list LAs + existing settings, change nothing

 
.\Set-LogicAppDiagnostics.ps1 -ResourceGroup my-rg -WorkspaceId $wsId `
    -SettingName whatever -Selection none

7. Run the tests

 
.\unit_test\Run-Tests.ps1

Auto-installs Pester 5 to CurrentUser if missing. Expected: Passed=129 Failed=0.

Selection grammar — cheat sheet

InputMeaning
1, 3, 7single index (1-based, matches the table)
1,3,5multiple indices
1-5inclusive range
1,3-5,8mixed
bareall LAs with no existing settings (recommended)
allevery LA (may fail on already-configured ones)
none (or empty / q / cancel)exit without changes

Why the auto-rename matters

Azure’s diagnostic-settings API is PUT — calling create --name la-diag on a Logic App that already has a setting named la-diag silently replaces the existing one. That’s a footgun if a colleague already set something up by hand.

LA-BulkDiag refuses to overwrite. Instead, when -SettingName is already in use on a given LA, it auto-appends -1, -2, … until it finds a free name, and reports the actual name in the summary’s FinalName column. If you genuinely want to replace an existing setting, delete it first:

 
az monitor diagnostic-settings delete -n <existing-name> --resource <la-id>

Where to go next

The GitHub repo has the full reference — parameter table, exit codes, status-value glossary, troubleshooting matrix (RBAC, MFA, throttling, category/sink conflicts), known limitations, and the full test inventory:

👉 https://github.com/dengyanbo/LA-BulkDiag

Published May 20, 2026
Version 1.0
No CommentsBe the first to comment