Editar

Compartilhar via


New-AzStorageAccountManagementPolicyFilter

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

Syntax

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.

Type:PSTagFilter[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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.

Type:String[]
Accepted values:blockBlob, appendBlob
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

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

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
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:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

PSManagementPolicyRuleFilter