2

I am new to using Azure bicep. I am trying to deploy a simple app service plan/app service with the following bicep file:

resource azBicepAsp1 'Microsoft.Web/serverfarms@2020-12-01' = {
  name: 'test-dev-aue-asp1'
  location: resourceGroup().location
  kind: ''
  sku: {
    name: 'F1'
    capacity: 1
  }
}

resource azbicepas 'Microsoft.Web/sites@2021-01-15' = {
  name: 'test-dev-aue-wapp1'
  location: resourceGroup().location
  properties: {
    serverFarmId: resourceId('Microsoft.Web/serverfarms', 'test-dev-aue-asp1')
  }
  dependsOn:[
    azBicepAsp1
  ]
}

using:

az deployment group create -g azbbicepad-dev-au-rg1 -f 2.AppServicePlan.bicep --confirm-with-what-if

It deploys sucesfully, however if I deploy it again with the exact same deployment it says the following changes will be made:

  - Delete
  + Create
  ~ Modify

The deployment will update the following scope:

Scope: /subscriptions/71913b63-cacf-41bf-9da1-e3a1db24e62c/resourceGroups/azbbicepad-dev-au-rg1

  ~ Microsoft.Web/serverfarms/test-dev-aue-asp1 [2020-12-01]
    - kind:         "app"
    ~ sku.capacity: 0 => 1

  ~ Microsoft.Web/sites/test-dev-aue-wapp1 [2021-01-15]
    + properties.siteConfig.localMySqlEnabled:   false
    + properties.siteConfig.netFrameworkVersion: "v4.6"

I don't quite understand why this occurs - could someone please point me in the right direction?

Thanks,

Thomas
  • 24,234
  • 6
  • 81
  • 125
dan
  • 45
  • 3

1 Answers1

1

Regarding the app service plan:

  • if you specify Free tier, the capacity is always 0. When you deploy your template the first time, the capacity specified is ignored and set to 0. When you redeploy, there is a mismatch between what's defined in the template and the target resource.
  • If you dont specify the kind, the default is app. Same here, there is a mismatch between the template and the target resource.

There is a good explanation on this post.:

Noise

One issue you may see when using this command is noise, where the results show that a resource is being changed when no change will occur. This is usually down to the fact that the information you provide to the ARM API to create or update a resource is less than the data returned when querying it, or that defaults are being used. An example seen early in the preview was when deploying a storage account, if you did not specify the encryption settings in the template (so using the defaults), then What-If showed a change because it thought it was removing these settings.

This is something the ARM team is aware of and are working to remove during the preview. They are asking for everyone using this command to keep an eye out for these issues and log them in this Github issues log. Please do log issues when you see them to help improve this command and get it out of preview as soon as possible.

Thomas
  • 24,234
  • 6
  • 81
  • 125