Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.25k stars 3.84k forks source link

KeyVault secret PURGE operation giving error 'Secret is currently being deleted' #24094

Open harmasingh opened 8 months ago

harmasingh commented 8 months ago

Description

I am facing an issue issue in which I am using Az.KeyVault Powershell library to do KV operations.

I am deleting a secret using Remove-AzKeyVaultSecret -VaultName $XYZ -Name $Secret and purging it using Remove-AzKeyVaultSecret -VaultName $XYZ -Name $Secret -InRemovedState

and I am getting the error:

Secret is currently being deleted.

There is a similar discussion here for az cli: https://github.com/Azure/azure-cli/issues/12722

Is there any command that returns the result only after the DELETE operation is completed? I understand that it is an async operation in the backend, and if the above is not possible, what is the approximate number of retries I should execute and with how much sleep time? What is the SLA? Currently, I have 20 seconds of sleep with 5 retries, and once in a while I am still getting the error.

microsoft-github-policy-service[bot] commented 8 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @RandalliLama, @schaabs, @jlichwa.

isra-fel commented 8 months ago

Let me loop in Key Vault service team.

microsoft-github-policy-service[bot] commented 8 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @RandalliLama, @schaabs, @jlichwa.

jlichwa commented 6 months ago

There is no SLA and it will depend on number of versions where each version is a separate call which have to be made on service side. Exponential backoff up to several minutes should be enough for most cases.