Description
Describe the bug
Executing az deployment what-if reports that only 2 resources will be created, when actually more than 10 resources are created when you actually deploy. The https://github.com/Azure-Samples/avm-bicep-labs/tree/main/labs/lab02 sample has been used. I have seen similar behaviour for other ARM template and bicep files
To Reproduce
Steps to reproduce the behavior:
- Clone the repo
git clone https://github.com/Azure-Samples/avm-bicep-labs/tree/main/labs/lab02
- az login to your subscription
- az deployment sub what-if --name test-dep-sub-scope-1 --template-file "avm-bicep-labs/labs/lab02/main.bicep" -p @avm-bicep-labs/labs/lab02/main.parameters.json -l westeurope
Result of above command is
$ az deployment sub what-if --name test-dep-sub-scope-1 --template-file "avm-bicep-labs/labs/lab02/main.bicep" -p @avm-bicep-labs/labs/lab02/main.parameters.json -l westeurope
Note: The result may contain false positive predictions (noise).
You can help us improve the accuracy of the result by opening an issue here: https://aka.ms/WhatIfIssues
Resource and property changes are indicated with this symbol:
+ Create
The deployment will update the following scopes
Scope: /subscriptions/SSSSSSSS-SSSS-SSSS-SSSS-SSSSSSSSSSSS
+ resourceGroups/rg-mpftst2-core [2023-07-01]
apiVersion: "2023-07-01"
id: "/subscriptions/SSSSSSSS-SSSS-SSSS-SSSS-SSSSSSSSSSSS/resourceGroups/rg-mpftst2-core"
location: "westeurope"
name: "rg-mpftst2-core"
type: "Microsoft.Resources/resourceGroups"
Scope: /subscriptions/SSSSSSSS-SSSS-SSSS-SSSS-SSSSSSSSSSSS/resourceGroups/rg-mpftst2-core
+ Microsoft.OperationalInsights/workspaces/law-mpftst2 [2022-10-01]
apiVersion: "2022-10-01"
id: "/subscriptions/SSSSSSSS-SSSS-SSSS-SSSS-SSSSSSSSSSSS/resourceGroups/rg-mpftst2-core/providers/Microsoft.OperationalInsights/workspaces/law-mpftst2"
location: "westeurope"
name: "law-mpftst2"
properties.forceCmkForQuery: true
properties.publicNetworkAccessForIngestion: "Enabled"
properties.publicNetworkAccessForQuery: "Enabled"
properties.retentionInDays: 365
properties.sku.name: "PerGB2018"
properties.workspaceCapping.dailyQuotaGb: -1
type: "Microsoft.OperationalInsights/workspaces"
Resource changes: 2 to create.
Actual behaviour
As described above what-if analysis shows only 2 resources would be created
$ az deployment sub what-if --name test-dep-sub-scope-1 --template-file "avm-bicep-labs/labs/lab02/main.bicep" -p @avm-bicep-labs/labs/lab02/main.parameters.json -l westeurope
Note: The result may contain false positive predictions (noise).
You can help us improve the accuracy of the result by opening an issue here: https://aka.ms/WhatIfIssues
Resource and property changes are indicated with this symbol:
+ Create
The deployment will update the following scopes
Scope: /subscriptions/SSSSSSSS-SSSS-SSSS-SSSS-SSSSSSSSSSSS
+ resourceGroups/rg-mpftst2-core [2023-07-01]
apiVersion: "2023-07-01"
id: "/subscriptions/SSSSSSSS-SSSS-SSSS-SSSS-SSSSSSSSSSSS/resourceGroups/rg-mpftst2-core"
location: "westeurope"
name: "rg-mpftst2-core"
type: "Microsoft.Resources/resourceGroups"
Scope: /subscriptions/SSSSSSSS-SSSS-SSSS-SSSS-SSSSSSSSSSSS/resourceGroups/rg-mpftst2-core
+ Microsoft.OperationalInsights/workspaces/law-mpftst2 [2022-10-01]
apiVersion: "2022-10-01"
id: "/subscriptions/SSSSSSSS-SSSS-SSSS-SSSS-SSSSSSSSSSSS/resourceGroups/rg-mpftst2-core/providers/Microsoft.OperationalInsights/workspaces/law-mpftst2"
location: "westeurope"
name: "law-mpftst2"
properties.forceCmkForQuery: true
properties.publicNetworkAccessForIngestion: "Enabled"
properties.publicNetworkAccessForQuery: "Enabled"
properties.retentionInDays: 365
properties.sku.name: "PerGB2018"
properties.workspaceCapping.dailyQuotaGb: -1
type: "Microsoft.OperationalInsights/workspaces"
Resource changes: 2 to create.
Expected behavior
As you can see from the bicep file and the lab02 description and Architecture over 10 resource should actually be created . I validated this by deploying the bicep code. I also manually tried generating the ARM from bicep and executing that, and saw the same behaviou1
Screenshots
If applicable, add screenshots to help explain your problem.
Client [e.g. PowerShell, CLI, API)
- I am using a M1 Mac
- az cli version : 2.71.0
- az bicep version: Bicep CLI version 0.34.44 (1f661a23c4)
Additional context
Add any other context about the problem here.