Delete/Update Retention policy on blob storage account
Hi Team,
I created a retention policy in UAT environment using below code snippet.
Code-
Create a new action object.
$action = Add-AzStorageAccountManagementPolicyAction -BaseBlobAction Delete `
-daysAfterModificationGreaterThan 180Create a new filter object.
$filter = New-AzStorageAccountManagementPolicyFilter -PrefixMatch token/ `
-BlobType blockBlobCreate a new rule object.
$rule1 = New-AzStorageAccountManagementPolicyRule -Name sample-rule
-Action $action
-Filter $filterCreate the policy.
Set-AzStorageAccountManagementPolicy -ResourceGroupName $rgName
-StorageAccountName $accountName
-Rule $rule1
The retention policy created fine for Blob name 'token'.
Below are my questions-
- how we can delete/update this retention policy from UAT through PowerShell, as we don't have access to delete it from azure portal.
- when I tried to create this retention policy to apply the filters and rules for a 3 blob containers named- token, AT, Stage. using prefix match as token/, AT/, Stage/ it started giving error.
Error - cannot process command because of one or more missing mandatory parameters: Rule
Please provide your input on this.
Thank you