Batch icon indicating copy to clipboard operation
Batch copied to clipboard

Bicep/ARM Template PropertyCannotBeUpdated

Open paupal1 opened this issue 3 years ago • 4 comments

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

paupal1 avatar Dec 09 '22 21:12 paupal1

Tagging @dpwatrous

alfpark avatar Jan 30 '23 23:01 alfpark

Confirmed this is a known issue with the owning team, they are tracking it internally. Will update this thread accordingly

staer avatar Mar 08 '23 17:03 staer

My incremental deployments fail with the same error, but for "deploymentConfiguration" property. Is it the same issue?

specialforest avatar Mar 08 '23 23:03 specialforest

There's a separate issue already open for the deploymentConfiguration property on the Batch pool resource https://github.com/Azure/Batch/issues/153

pateljay-37 avatar Mar 08 '23 23:03 pateljay-37