`Microsoft.DataProtection/BackupVaults/backupPolicies` is not idempotent
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 21m
- Merged PRs (30d)
- 79
Description
**Bicep version**
This is an ARM bug which I don't know where to report properly, but needs action.
**Describe the bug**
`Microsoft.DataProtection/BackupVaults/backupPolicies@2020-01-01` is not idempotent. It errors out with `Status Message: Update of existing policy is not supported. (Code:UserErrorBMSUpdatePolicyNotSupported)`
**To Reproduce**
Steps to reproduce the behaviour would be something similar like this (ARM):
```arm
"type": "Microsoft.DataProtection/BackupVaults/backupPolicies",
"apiVersion": "2020-01-01-alpha",
"name": "[concat(variables('vaultNameRegion'),'/',parameters('policyName'))]",
"dependsOn": [
"[resourceId('Microsoft.DataProtection/BackupVaults', variables('vaultNameRegion'))]"
],
"properties":
{
"policyRules": [
{
"name": "Default",
"objectType": "AzureRetentionRule",
"isDefault": true,
"lifecycles": [
{
"deleteAfter": {
"duration": "P30D",
"objectType": "AbsoluteDeleteOption"
},
"sourceDataStore": {
"dataStoreType": "OperationalStore",
"objectType": "DataStoreInfoBase"
},
"targetDataStoreCopySettings": []
}
]
}
],
"datasourceTypes": [
"Microsoft.Storage/storageAccounts/blobServices"
],
"objectType": "BackupPolicy",
"name": "[parameters('policyName')]"
}
}
```
**Additional context**
Reported [here](https://docs.microsoft.com/en-us/answers/questions/468053/azure-backup-vault-azure-blob-policy.html) as well.
Fixing it with a feature flag or PowerShell is not a solution imho, providing Bicep with an option to check if this resource exists and conditionally create it is.
Contributor guide
Research direction
Start by deploying the supplied ARM template for Microsoft.DataProtection/BackupVaults/backupPolicies@2020-01-01-alpha twice and compare the failure with the Azure Answers report. Determine whether the behavior is actionable in Bicep or belongs to Azure Resource Manager; done should be a documented, supported path for repeated deployment without the update-policy error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100