I'm a contractor working on an existing Azure project. Currently, my client is manually configuring all their Azure resources for each environment (Dev, QA, Prod). I know this is shocking to people, but their subscriptions are a mess. I'm trying to setup IaC deployments using bicep.
For the Azure App Services, they have an IP Access Restriction setup to only allow traffic from their APIM instance. When I look at the access restrictions for the app service (under networking) for the main site, I can see it listed.
However, when I deploy using --what-if, it comes back saying it will create the access restriction rule. I'm not expecting this because it should already exist. I've searched high and low but can't find the answer.
apiAppService.bicep
@description('The name of the target app service without any prefix or suffix. i.e. Contoso')
param apiName string
@description('The abbreviation of the target environment. i.e. dev')
@allowed([
  'dev'
  'qa'
  'prod'
])
param environment string
@description('The Azure region the resource group is to be created in.')
param region string
@description('The abbreviation of the Azure region included as part of the resource group name. i.e. NCUS')
param regionAbbreviation string
@description('The properties of the SKU for the app service plan.')
param appServicePlanSku object
@description('The runtime stack of the target app service. i.e. DOTNETCORE|6.0')
param runtimeStack string
@description('The values required to setup the IP access restriction')
param ipRestriction object
var appServicePlanName = 'ASP-${apiName}-${regionAbbreviation}-${environment}'
var appServiceName = 'productname-${apiName}-api-${environment}'
resource appServicePlan 'Microsoft.Web/serverfarms@2022-03-01' = {
  name: appServicePlanName
  location: region
  sku: {
    name: appServicePlanSku.name
    tier: appServicePlanSku.tier
  }
  kind: 'linux'
  properties: {
    reserved: true
  }
}
resource appService 'Microsoft.Web/sites@2022-03-01' = {
  name: appServiceName
  location: region
  identity: {
    type: 'SystemAssigned'
  }
  properties: {
    serverFarmId: appServicePlan.id
    httpsOnly: true
    siteConfig: {
      linuxFxVersion: runtimeStack
      ipSecurityRestrictions: [
        {
          name: ipRestriction.name
          action: ipRestriction.action
          priority: ipRestriction.priority
          ipAddress: ipRestriction.ipAddress
        }
      ]
    }
  }
}
The results of the --what-if deployment
 ~ Microsoft.Web/sites/productname-apiname-api-dev [2022-03-01]
    + properties.siteConfig.ipSecurityRestrictions: [
        0:
          action:    "allow"
          ipAddress: "a.b.c.d/32"
          name:      "Allow ONLY APIM"
          priority:  300
      ]
    + properties.siteConfig.localMySqlEnabled: false
    ~ properties.httpsOnly:                    false => true
Am I trying to configure different things? What am I doing wrong?

