Edit

Share via


New-AzStorageAccountManagementPolicyFilter

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

Syntax

Default (Default)

New-AzStorageAccountManagementPolicyFilter
    [-PrefixMatch <String[]>]
    [-BlobType <String[]>]
    [-BlobIndexMatch <PSTagFilter[]>]
    [-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

$blobindexmatch1 = New-AzStorageAccountManagementPolicyBlobIndexMatchObject -Name "tag1" -Value "value1"
$blobindexmatch2 = New-AzStorageAccountManagementPolicyBlobIndexMatchObject -Name "tag2" -Value "value2"
$filter = New-AzStorageAccountManagementPolicyFilter -PrefixMatch blobprefix1,blobprefix2 -BlobType appendBlob,blockBlob -BlobIndexMatch $blobindexmatch1,$blobindexmatch2
$filter

PrefixMatch                BlobTypes               BlobIndexMatch
-----------                ---------               --------------
{blobprefix1, blobprefix2} {appendBlob, blockBlob} {tag1, tag2}

$action = Add-AzStorageAccountManagementPolicyAction -BaseBlobAction Delete -daysAfterModificationGreaterThan 100
$rule = New-AzStorageAccountManagementPolicyRule -Name Test -Action $action -Filter $filter
$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

-BlobIndexMatch

An array of blob index tag based filters, there can be at most 10 tag filters.

Parameter properties

Type:

PSTagFilter[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-BlobType

An array of strings for blobtypes to be match. Currently blockBlob supports all tiering and delete actions. Only delete actions are supported for appendBlob.

Parameter properties

Type:

String[]

Default value:None
Accepted values:blockBlob, appendBlob
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultProfile

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

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PrefixMatch

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

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

None

Outputs

PSManagementPolicyRuleFilter