Thank you for your post!
I understand that you're trying to update all of your Secret versions and expiration dates within your Key Vault using Azure CLI. However, when using the az keyvault secret set
command, this only updates the current Secret version and not all of the Secrets within your Key Vault. To hopefully point you in the right direction or help resolve your issue, I'll share my findings below.
Findings:
When it comes to the az keyvault secret CLI commands, az keyvault secret set
will only update the current Secret version and not all of the Secrets within your Key Vault, since it only references one Secret at a time through --name
. For more info.
To update all of the Secrets within your Key Vault, you can try using the az keyvault secret list command to list all of the Secrets, and then use a loop to update each Secret individually. For example:
for secret in $(az keyvault secret list --vault-name "KVName" --query "[].id" -o tsv); do
az keyvault secret set-attributes --id $secret --expires "2024-06-14T22:00:00Z"
done
Additional Links:
I hope this helps!
If you have any other questions, please let me know. Thank you for your time and patience throughout this issue.
If the information helped address your question, please Accept the answer. This will help us and also improve searchability for others in the community who might be researching similar information.