-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keys in key vault can't be updated via Bicep #1906
Comments
+1 following |
Is there any workaround? |
+1 |
+1 |
+1 looking for the same |
+1 |
Not sure how this issue slipped through the cracks, but this is not something we can fix in the bicep side. It would be good if one of the recent commentors on this thread can open up a support ticket so that the Key Vault team can take a look. It is also related to Azure/bicep#4023 |
+1 |
Only way I've done it is with a conditional if statement with a bool param to switch off key deployment after initial creation. Really silly this hasn't being fixed yet it's such a pain. |
Thanks for workaround. I will develop that. Is not the ideal, but we need something :) |
Our group created a custom deployment script to perform the existence check as a way around the input param. Required submodules and credentials passed in to do the lookup so I don't recommend that approach as it's complicated. @rebel24 approach is less messy imo, but this is still a workaround to a nearly 2-year problem. As @alex-frankel recommendeded, someone needs to push on the key vault product group to have this fixed in the provider but apparently there are no takers bc we've all come here to discover a workaround is needed and that pain is prefferable to a MS support ticket. |
Let's hope it's not the intune team as right now support there is absolutely ridiculous... The other side of it is why can't this be pushed internally without us having to create a ticket. Honestly doesn't make sense. |
We tried using the deployment script in bicep to create an az cli call to check if a key already exist. But the problem with this is the amount of rights needed to perform this. I'm kind of surprised bicep doesn't support either validating if resource exist or allowing a conditional property value that doesn't try to override the existing value. At the moment we need to do a az cli call in yaml task and push the result in env variable we read in bicep to determine if a key with exp has already been created. If this is the case, our bicep will fail even though if the values are static for exp value. To be honest this is bad practice, you want to keep your IAC as much together as possible. Even worse, the azure verfiied modules for keyvault also have this issue. I was hoping they would be able to solve this. @alex-frankel can you update us on the progress of this bicep bug on keyvault side. |
@alex-frankel Just checking in if there is any progress on this short coming in bicep? Would love to have the ability to verify if certain component aspects are present. Especially with checking if a key already exist as this usecase has very big short comings on doing proper IaC. At our client ACR are very restricted due to the nature of security aspects of ACR's, there for using deploymentScripts isn't really possible. |
Bicep version
Bicep CLI version 0.9.1 (a2950a16df)
Describe the bug
Once a key with an expiration is created in key vault, the expiration date can not be updated in Bicep when performing a deployment update.
The deployment will error with the following
{"status":"Failed","error":{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.","details":[{"code":"BadRequest","message":"{\r\n "error": {\r\n "code": "KeyCreationParametersDidNotMatchExistingKey",\r\n "message": "[KeyCreationParametersDidNotMatchExistingKey (BadRequest)] The key 'thisIsAsecret2' already exists, but the specified key creation parameters did not match that of the existing key (The existing key has an expiration date of '9/20/2022 9:26:16 AM', which doesn't match the given expiration date '9/20/2022 9:42:56 AM'.). This API can only be used for creating the first version of a new key (no subsequent versions
can be created, and existing keys cannot be updated)."\r\n }\r\n}"}]}}
To Reproduce
Steps to reproduce the behavior:
e.g.
The text was updated successfully, but these errors were encountered: