Advertisement
leon

EnableSoftDelete-On-KeyVault

Nov 13th, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #create a log file
  2. Start-Transcript "c:\AzureADELogging.txt" -Append
  3.  
  4. #Find out if 'Soft Delete’ is Enabled for all KeyVaults in all subscriptions.  
  5. Get-AzKeyVault -VaultName "kyvazewdzzzz001diskcrypt”
  6.  
  7. #Enabling ‘Soft Delete’ on an existing Key Vault
  8. ($resource = Get-AzResource -ResourceId (Get-AzKeyVault -VaultName " kyvazewdzzzz001diskcrypt").ResourceId).Properties | Add-Member -MemberType "NoteProperty" -Name "EnableSoftDelete" -Value "true"
  9. #then run the below
  10. Set-AzResource -resourceid $resource.ResourceId -Properties $resource.Properties  
  11.  
  12. #Run the Get-AzKeyVault command again to check that the Soft Delete feature has been enabled
  13. Get-AzKeyVault -VaultName "kyvazewdzzzz001diskcrypt”
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement