Azure / Azure/bicep

Adding secret to key vault fails "because the Key Vault changed from the point the operation began."

Open
#4,364 6 comments 0 reactions 0 assignees View on GitHub
error-message provider bug provider improvement
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 2h
Merged PRs (30d)
79

Description

**Bicep version**

Bicep CLI version 0.4.613 (d826ce8411)

**Describe the bug**

I'm getting this error when I'm trying to add a secret to a key vault.

_A conflict occurred that prevented the operation from completing. The operation failed because the Key Vault 'my-keyvault-dev' changed from the point the operation began. This can happen if parallel operations are being performed on the Key Vault. To prevent this error, serialize the operations so that only one operation is performed on the Key Vault at a time. Follow this link for more information: https://go.microsoft.com/fwlink/?linkid=2147741_

![image](https://user-images.githubusercontent.com/900766/132819533-50ad0407-cd13-4b18-a5bc-24324ea3d705.png)

**To Reproduce**
Steps to reproduce the behavior:

Actually, it's hard to pinpoint what's causes it, because it doesn't happen all the time. Seems related to how "complex" the key vault operations are.

```
resource keyVault 'Microsoft.KeyVault/vaults@2019-09-01' existing = {
name: 'my-keyvault-dev'

resource newSecret 'secrets' = {
name: 'test-credentials'
properties: {
attributes: {
enabled: true
}
contentType: 'foo'
value: 'foo'
}
}
}
```

Then run it like this:

`az deployment group create --resource-group bsl-dev-rg01 --template-file .\deploy.bicep -c`

The preview (what-if) looks fine. But when I say `y` it starts to spin and then that error is displayed. I wonder if I'm doing something wrong here or what's going on?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the deployment from deploy.bicep with `az deployment group create --resource-group bsl-dev-rg01 --template-file .\deploy.bicep -c`, comparing the successful what-if with the failing deployment. Investigate the intermittent Key Vault conflict during the nested secret operation; done means identifying a reliable cause and documenting or correcting the deployment behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
cli, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.