Advertisement
Guest User

EnableSoftDelete-On-KeyVault

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