Answered by:
Permanent deletion of soft delete enabled Azure Key Vault or disable soft Delete for key Vault

Question
-
Answers
-
Hi Pardhasaradhi ,
Once soft delete is enabled for Azure Key Vault you cannot disable the soft-delete as it's implemented as a one-way operation and cannot be changed back once enabled. However, You can use the PowerShell cmdlet Remove-AzureRmKeyVault command with the option -InRemovedState and by specifying the location of the deleted key vault with the -Location argument to permanently delete or purge the Azure Key Vault. If you want to permanently delete a key or secret you need to use Remove-AzureKeyVaultKey and Remove-AzureKeyVaultSecret with -InRemovedState parameter. Please refer to How to use Key Vault soft-delete with PowerShell for details.
You can also achieve the same using the Azure CLI. Refer to How to use Key Vault soft-delete with CLI for details.
- Proposed as answer by SaurabhSharma-MSFTMicrosoft employee, Moderator Thursday, January 17, 2019 6:51 PM
- Edited by SaurabhSharma-MSFTMicrosoft employee, Moderator Thursday, January 17, 2019 7:02 PM
- Marked as answer by Pardhasaradhi reddy Friday, January 18, 2019 12:11 PM
All replies
-
Hi Pardhasaradhi ,
Once soft delete is enabled for Azure Key Vault you cannot disable the soft-delete as it's implemented as a one-way operation and cannot be changed back once enabled. However, You can use the PowerShell cmdlet Remove-AzureRmKeyVault command with the option -InRemovedState and by specifying the location of the deleted key vault with the -Location argument to permanently delete or purge the Azure Key Vault. If you want to permanently delete a key or secret you need to use Remove-AzureKeyVaultKey and Remove-AzureKeyVaultSecret with -InRemovedState parameter. Please refer to How to use Key Vault soft-delete with PowerShell for details.
You can also achieve the same using the Azure CLI. Refer to How to use Key Vault soft-delete with CLI for details.
- Proposed as answer by SaurabhSharma-MSFTMicrosoft employee, Moderator Thursday, January 17, 2019 6:51 PM
- Edited by SaurabhSharma-MSFTMicrosoft employee, Moderator Thursday, January 17, 2019 7:02 PM
- Marked as answer by Pardhasaradhi reddy Friday, January 18, 2019 12:11 PM
-
-
-
-
I have an issue permanently deleting a protected key vault. As a test I created several vaults with soft delete and purge protection enabled. Now, I need to test the script more but I am unable to provision the key vault because it says it already exists. Additionally I try to remove the vault but get this error. How do I rectify?
VERBOSE: Performing the operation "Purge vault" on target "S1TestVault.
Remove-azkeyvault : Operation 'DeletedVaultPurge' is not allowed.
At line:1 char:34
+ ... ovedState | Remove-azkeyvault -InRemovedState -Location 'East US' -Co ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Remove-AzKeyVault], CloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.KeyVault.RemoveAzureKeyVault