Home > other >  Azure Bicep - Object reference not set to an instance
Azure Bicep - Object reference not set to an instance

Time:08-25

I'm trying to create a simple App Service Plan with the below code.

param Location string = 'eastus'
resource appServicePlan1 'Microsoft.Web/serverfarms@2020-12-01' = {
  name: 'myasp'
  location: Location
  sku: {
    name: 'S1'
    capacity: 1
    }
}

Below is the Azure CLI command that I'm using to execute the above Bicep script

az deployment group create --name deploy1 --resource-group az-devops-eus-dev-rg1 --template-file main.bicep

Below is the screenshot

enter image description here

All this was working earlier. I'm using the latest version of Bicep (v0.9.1) which is available as of today.

Any pointers on why this is occurring now would be much appreciated.

Thanks, Praveen Sreeram

CodePudding user response:

Just had this issue in a MS workshop. We solved it by adding a empty properties-element to the appServicePlan. Ex.

param Location string = 'eastus'
resource appServicePlan1 'Microsoft.Web/serverfarms@2020-12-01' = {
  name: 'myasp'
  location: Location
  properties: {}
  sku: {
    name: 'S1'
    capacity: 1
    }
}
  • Related