New-AzStorageBlobInventoryPolicyRule
Creates a blob inventory policy rule object, which can be used in Set-AzStorageBlobInventoryPolicy.
Note
This is the previous version of our documentation. Please consult the most recent version for up-to-date information.
Syntax
New-AzStorageBlobInventoryPolicyRule
[-Name] <String>
[-Disabled]
-Destination <String>
-Format <String>
-Schedule <String>
-BlobSchemaField <String[]>
-BlobType <String[]>
[-PrefixMatch <String[]>]
[-IncludeSnapshot]
[-IncludeBlobVersion]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
New-AzStorageBlobInventoryPolicyRule
[-Name] <String>
[-Disabled]
-Destination <String>
-Format <String>
-Schedule <String>
-ContainerSchemaField <String[]>
[-PrefixMatch <String[]>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The New-AzStorageBlobInventoryPolicyRule cmdlet creates a blob inventory policy rule object, which can be used in Set-AzStorageBlobInventoryPolicy.
Examples
Example 1: Create blob inventory policy rule objects, then sets blob inventory policy with the rule objects.
PS C:\> $rule1 = New-AzStorageBlobInventoryPolicyRule -Name Test1 -Destination $containerName -Disabled -Format Csv -Schedule Daily -ContainerSchemaField Name,Metadata,PublicAccess,Last-mOdified,LeaseStatus,LeaseState,LeaseDuration,HasImmutabilityPolicy,HasLegalHold -PrefixMatch con1,con2
PS C:\> $rule2 = New-AzStorageBlobInventoryPolicyRule -Name Test2 -Destination $containerName -Format Parquet -Schedule Weekly -IncludeBlobVersion -IncludeSnapshot -BlobType blockBlob,appendBlob -PrefixMatch aaa,bbb `
-BlobSchemaField name,Creation-Time,Last-Modified,Content-Length,Content-MD5,BlobType,AccessTier,AccessTierChangeTime,Expiry-Time,hdi_isfolder,Owner,Group,Permissions,Acl,Metadata
PS C:\> $policy = Set-AzStorageBlobInventoryPolicy -ResourceGroupName myresourcegroup" -AccountName "mystorageaccount" -Disabled -Rule $rule1,$rule2
PS C:\> $policy
StorageAccountName : mystorageaccount
ResourceGroupName : myresourcegroup
Name : DefaultInventoryPolicy
Id : /subscriptions/{subscription-Id}/resourceGroups/myresourcegroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount/inventoryPolicies/default
Type : Microsoft.Storage/storageAccounts/inventoryPolicies
LastModifiedTime : 5/12/2021 8:53:38 AM
Enabled : False
Rules : {Test1, Test2}
PS C:\> $policy.Rules
Name Enabled Destination ObjectType Format Schedule IncludeSnapshots IncludeBlobVersions BlobTypes PrefixMatch SchemaFields
---- ------- ----------- ---------- ------ -------- ---------------- ------------------- --------- ----------- ------------
Test1 False containername Container Csv Daily {con1, con2} {Name, Metadata, PublicAccess, Last-Modified...}
Test2 True containername Blob Parquet Weekly True True {blockBlob, appendBlob} {aaa, bbb} {Name, Creation-Time, Last-Modified, Content-Length...}
This first 2 commands create 2 BlobInventoryPolicy rule objects: rule "Test1" for contaienr inventory; rule "Test2" for blob inventory. The following command sets blob inventory policy to a Storage account with the 2 rule objects, then show the updated policy and rules properties.
Parameters
Specifies the fields and properties of the Blob object to be included in the inventory. Valid values include: Name, Creation-Time, Last-Modified, Content-Length, Content-MD5, BlobType, AccessTier, AccessTierChangeTime, Expiry-Time, hdi_isfolder, Owner, Group, Permissions, Acl, Metadata, LastAccessTime, AccessTierInferred, Tags. 'Name' is a required schemafield. Schema field values 'Expiry-Time, hdi_isfolder, Owner, Group, Permissions, Acl' are valid only for HierarchicalNamespace enabled accounts.'Tags' field is only valid for non HierarchicalNamespace accounts. If specify '-IncludeSnapshot', will include 'Snapshot' in the inventory. If specify '-IncludeBlobVersion', will include 'VersionId, 'IsCurrentVersion' in the inventory.
| Type: | String[] |
| Accepted values: | Name, Creation-Time, Last-Modified, Content-Length, Content-MD5, BlobType, AccessTier, AccessTierChangeTime, Expiry-Time, hdi_isfolder, Owner, Group, Permissions, Acl, Metadata, LastAccessTime, AccessTierInferred, Tags |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Sets the blob types for the blob inventory policy rule. Valid values include blockBlob, appendBlob, pageBlob. Hns accounts does not support pageBlobs.
| Type: | String[] |
| Accepted values: | blockBlob, pageBlob, appendBlob |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Specifies the fields and properties of the container object to be included in the inventory. Valid values include: Name, Last-Modified, Metadata, LeaseStatus, LeaseState, LeaseDuration, PublicAccess, HasImmutabilityPolicy, HasLegalHold. 'Name' is a required schemafield.
| Type: | String[] |
| Accepted values: | Name, Last-Modified, Metadata, LeaseStatus, LeaseState, LeaseDuration, PublicAccess, HasImmutabilityPolicy, HasLegalHold |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The credentials, account, tenant, and subscription used for communication with Azure.
| Type: | IAzureContextContainer |
| Aliases: | AzContext, AzureRmContext, AzureCredential |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The container name where blob inventory files are stored. Must be pre-created.
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The rule is disabled if set it.
| Type: | SwitchParameter |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Specifies the format for the inventory files. Possible values include: 'Csv', 'Parquet'
| Type: | String |
| Accepted values: | Csv, Parquet |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The rule is disabled if set it.
| Type: | SwitchParameter |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The rule is disabled if set it.
| Type: | SwitchParameter |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
A rule name can contain any combination of alpha numeric characters. Rule name is case-sensitive. It must be unique within a policy.
| Type: | String |
| Position: | 0 |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Sets an array of strings for blob prefixes to be matched..
| Type: | String[] |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
This field is used to schedule an inventory formation. Possible values include: 'Daily', 'Weekly'
| Type: | String |
| Accepted values: | Daily, Weekly |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Inputs
None