Skip to content

Bicep/ARM Template PropertyCannotBeUpdated #144

@paupal1

Description

@paupal1

Problem Description

  • Support requests should be raised from within the Azure Portal and not
    through GitHub.
  • All sensitive information should be redacted if filing an issue on GitHub.

Steps to Reproduce

resource batchAccount 'Microsoft.Batch/batchAccounts@2022-06-01' = {
  name: '${serviceName}batch${locationAbbr}${environmentAbbr}'
  location: siteLocation
  properties: {
    allowedAuthenticationModes: [
      'AAD'
      'SharedKey'
      'TaskAuthenticationToken'
    ]
    autoStorage: {
      storageAccountId: storageAccount.id
      authenticationMode: 'StorageKeys'
    }
  }
  identity: {
    type: 'SystemAssigned'
  }
  resource cert 'certificates@2022-10-01' = {
    name: 'SHA1-${certThumbprint}'
    properties: {
      format: 'Cer'
      thumbprint: certThumbprint
      data: certData
    }
  }
}

Deploy twice.

Expected Results

I would expect ARM Templates to be idempotent.

ARM template philosophy: "Repeatable results: Repeatedly deploy your infrastructure throughout the development lifecycle and have confidence your resources are deployed in a consistent manner. Templates are idempotent, which means you can deploy the same template many times and get the same resource types in the same state. You can develop one template that represents the desired state, rather than developing lots of separate templates to represent updates."

Actual Results

The second deployment fails due to "PropertyCannotBeUpdated" error.

{
    "status": "Failed",
    "error": {
        "code": "PropertyCannotBeUpdated",
        "target": "BatchAccount",
        "message": "A property that cannot be updated was specified as part of the request.\nRequestId:448116c9-8450-4ae1-a844-9f497232163b\nTime:2022-12-09T21:07:17.6229515Z",
        "details": [
            {
                "code": "Reason",
                "message": "A property that cannot be updated was specified as part of the request."
            },
            {
                "code": "PropertyName",
                "message": "data"
            },
            {
                "code": "PropertyPath",
                "message": "properties.data"
            }
        ]
    }
}

Additional Logs

INSERT ADDITIONAL LOGS HERE

Additonal Comments

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions