New-AzStorageAccountManagementPolicyFilter

Creates a ManagementPolicy rule filter object, which can be used in New-AzStorageAccountManagementPolicyRule.

Syntax

New-AzStorageAccountManagementPolicyFilter
   [-PrefixMatch <String[]>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The New-AzStorageAccountManagementPolicyFilter cmdlet creates a ManagementPolicy rule filter object, which can be used in New-AzStorageAccountManagementPolicyRule.

Examples

Example 1: Creates a ManagementPolicy rule filter object, then add it to a management policy rule and set to a Storage account

PS C:\>$filter = New-AzStorageAccountManagementPolicyFilter -PrefixMatch blobprefix1,blobprefix2
PS C:\>$filter 

PrefixMatch                BlobTypes  
-----------                ---------  
{blobprefix1, blobprefix2} {blockBlob}

PS C:\>$action = Add-AzStorageAccountManagementPolicyAction -BaseBlobAction Delete -daysAfterModificationGreaterThan 100
PS C:\>$rule = New-AzStorageAccountManagementPolicyRule -Name Test -Action $action -Filter $filter
PS C:\>$policy = Set-AzStorageAccountManagementPolicy -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount" -Rule $rule

This command create a ManagementPolicy rule filter object. Then add it to a management policy rule and set to a Storage account.

Parameters

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PrefixMatch

An array of strings for prefixes to be match. A prefix string must start with a container name.

Type:System.String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

Microsoft.Azure.Commands.Management.Storage.Models.PSManagementPolicyRuleFilter