---
title: "Get a real ARM what-if for resources hidden behind a short-circuited nested deployment"
url: "https://www.dariuszparys.com/notes/arm-what-if-short-circuited-nested-deployment"
author: "Dariusz Parys"
published: 2026-11-26T00:00:00.000Z
description: "ARM what-if reports every resource in a nested deployment as Ignore when the module receives an object output or reference() value, so new resources are never checked against the live environment."
tags:
  - "Azure"
  - "Bicep"
---

# Get a real ARM what-if for resources hidden behind a short-circuited nested deployment

## Context

Sometimes a Bicep entry point passes a module's `object` output, or any `reference()` value, into a nested module. When it does, `what-if` reports the nested deployment as `NestedDeploymentShortCircuited` and skips validating it. Every resource comes back as `Ignore`, so new resources are never checked against the live environment.

## Insight

Preview the new resources with a throwaway template in a scratch folder:

- Declare the new resources, or call the new module, with **literal resource names** where the real template uses outputs.
- Reference existing resources with `existing`.
- Bicep refuses absolute module paths (`BCP051`), so copy the module next to the scratch template and call it through a relative path.

The result is a real `Create`/`Modify` diff against live state, including property-level before/after values. Resource locks, SQL backup retention policies, auditing settings and diagnostic settings all preview correctly this way.

## Snippet

```bicep
// scratch.bicep
resource sqlServer 'Microsoft.Sql/servers@2023-08-01' existing = { name: '<sql-server>' }
resource db 'Microsoft.Sql/servers/databases@2023-08-01' existing = { parent: sqlServer, name: '<db>' }

resource str 'Microsoft.Sql/servers/databases/backupShortTermRetentionPolicies@2023-08-01' = {
  parent: db
  name: 'default'
  properties: { retentionDays: 35 }
}

module locks 'resource-locks.bicep' = {   // copied next to this file
  name: 'wi-locks'
  params: { sqlServerName: '<sql-server>', storageAccountName: '<storage>', keyVaultName: '<kv>' }
}
```

```bash
az deployment group what-if -g <rg> --template-file scratch.bicep \
  --no-pretty-print \
  --query "changes[?changeType!='Ignore'].{type:changeType,id:resourceId,delta:delta[].{p:path,b:before,a:after}}" \
  -o json
```

The `--query` filter drops the `Ignore` noise and shows only the real changes. `what-if` is read-only, so this is safe against production.
