azure-resource-managerazure-bicep

azure bicep deployment modifies network interface resources even though there are no changes


I am building a Azure bicep script to deploy network interfaces that get used by VMs and added to LB backend pool. Here's the bicep code:

resource masterNic0 'Microsoft.Network/networkInterfaces@2024-05-01' = {
  name: 'mymasternic-${resourceSuffix}-0'
  location: location
  properties: {
    networkSecurityGroup: {
      id: nsg.id
    }
    ipConfigurations: [
      {
        name: 'ipconfig1'
        properties: {
          subnet: {
            id: subnetNetworkID
          }
        }
      }
    ]
  }
}

The bicep what-if output always indicates changes to be done:

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 these symbols:
  - Delete
  ~ Modify

The deployment will update the following scope:

Scope: /subscriptions/mysubscriptionid/resourceGroups/myresourcegroup

  ~ Microsoft.Network/networkInterfaces/mymasternic-dev-0 [2024-05-01]
    - kind:                                          "Regular"
    - properties.allowPort25Out:                     false
    - properties.auxiliaryMode:                      "None"
    - properties.auxiliarySku:                       "None"
    - properties.defaultOutboundConnectivityEnabled: false
    - properties.disableTcpStateTracking:            false
    ~ properties.ipConfigurations: [
      ~ 0:

        - properties.privateIPAddress:        "144.43.72.13"
        - properties.privateIPAddressVersion: "IPv4"

      ]

Resource changes: 1 to modify.

Are you sure you want to execute the deployment? (y/n): 

Not sure why this is coming? Is it because I am not specifying a single IP address? I want the IP to be picked up dynamically. I tried the deployment with both Incremental and Complete mode but seem to get same result.


Solution

  • Some of the properties that are listed as deleted won't actually change. Properties can be incorrectly reported as deleted when they aren't in the Bicep file, but are automatically set during deployment as default values. This result is considered "noise" in the what-if response. The final deployed resource will have the values set for the properties. As the what-if operation matures, these properties will be filtered out of the result.


    I have found a similar officail explanation, which seem the build-in feature, and called this nosie. Hope this can help.

    Doc links


    When the whatif command runs, the first notices also shows: enter image description here