Azure / Azure/bicep

Issues with certain properties in API Microsoft.Batch/batchAccounts/pools@2022-06-01 not accpeting empty array or string

Open
#7,902 0 comments 0 reactions 0 assignees View on GitHub
provider bug
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 2h
Merged PRs (30d)
79

Description

**Bicep version**
Bicep CLI version 0.9.1 (a2950a16df)

**Describe the bug**
Certain properties in API Microsoft.Batch/batchAccounts/pools@2022-06-01 do not accept empty array or empty string as value when you do re-deployment. Such properties are:
userAccounts
mountConfiguration
applicationLicenses
ipAddressIds
displayName

there could be more.

For example if you have code like this:

```

mountConfiguration: [for (mount, i) in union(pool.mountAzureFileShares, pool.mountAzureStorageContainers): {
azureFileShareConfiguration: empty(union(defaultMount, mount).shareName) ? null : {
accountKey: mountAzureFileShares[i].listKeys().keys[0].value
relativeMountPath: mount.relativeMountPath
accountName: mount.name
azureFileUrl: 'https://${mount.name}.file.${environment().suffixes.storage}/${mount.shareName}'
mountOptions: union(defaultMount, mount).mountOptions
}
azureBlobFileSystemConfiguration: empty(union(defaultMount, mount).containerName) ? null : {
containerName: mount.containerName
relativeMountPath: mount.relativeMountPath
accountName: mount.name
blobfuseOptions: union(defaultMount, mount).blobFuseOptions
identityReference: {
resourceId: mountAzureStorageContainersIdentities[i].id
}
}
}]
```

and you deploy without specifying mountConfiguration it will succeed on initial deployment. Upon re-deployment it will fail with error PropertyCannotBeUpdated: A property that cannot be updated was specified as part of the request.

This makes the API hard to use as you will have to create additional condition on the property to set it to null if no mounts are specified. With that workaround you will also have to put the for loop into variable as once you have condition on property you cannot do for loop. Particularly in the example above that workaround is not possible as you cannot use the listKeys() function inside variable.

**To Reproduce**
Described.

**Additional context**
Add any other context about the problem here.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the redeployment failure for Microsoft.Batch/batchAccounts/pools@2022-06-01 using the provided mountConfiguration example and the listed empty properties. Compare the initial deployment with redeployment and verify that the reported PropertyCannotBeUpdated error is addressed without requiring the described workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.