Blob Inventory Policies - Create Or Update

Sets the blob inventory policy to the specified storage account.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/default?api-version=2026-04-01

URI Parameters

Name In Required Type Description
accountName
path True

string

minLength: 3
maxLength: 24
pattern: ^[a-z0-9]+$

The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.

blobInventoryPolicyName
path True

BlobInventoryPolicyName

The name of the storage account blob inventory policy. It should always be 'default'

resourceGroupName
path True

string

minLength: 1
maxLength: 90

The name of the resource group. The name is case insensitive.

subscriptionId
path True

string (uuid)

The ID of the target subscription. The value must be an UUID.

api-version
query True

string

minLength: 1

The API version to use for this operation.

Request Body

Name Required Type Description
properties.policy True

BlobInventoryPolicySchema

The storage account blob inventory policy object. It is composed of policy rules.

Responses

Name Type Description
200 OK

BlobInventoryPolicy

Resource 'BlobInventoryPolicy' update operation succeeded

Other Status Codes

CloudError

An unexpected error response.

Security

azure_auth

Azure Active Directory OAuth2 Flow.

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

StorageAccountSetBlobInventoryPolicy
StorageAccountSetBlobInventoryPolicyIncludeDeleteAndNewSchemaForHnsAccount
StorageAccountSetBlobInventoryPolicyIncludeDeleteAndNewSchemaForNonHnsAccount

StorageAccountSetBlobInventoryPolicy

Sample request

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/res7687/providers/Microsoft.Storage/storageAccounts/sto9699/inventoryPolicies/default?api-version=2026-04-01

{
  "properties": {
    "policy": {
      "type": "Inventory",
      "enabled": true,
      "rules": [
        {
          "name": "inventoryPolicyRule1",
          "definition": {
            "format": "Csv",
            "filters": {
              "blobTypes": [
                "blockBlob",
                "appendBlob",
                "pageBlob"
              ],
              "creationTime": {
                "lastNDays": 1000
              },
              "includeBlobVersions": true,
              "includeSnapshots": true,
              "prefixMatch": [
                "inventoryprefix1",
                "inventoryprefix2"
              ]
            },
            "objectType": "Blob",
            "schedule": "Daily",
            "schemaFields": [
              "Name",
              "Creation-Time",
              "Last-Modified",
              "Content-Length",
              "Content-MD5",
              "BlobType",
              "AccessTier",
              "AccessTierChangeTime",
              "Snapshot",
              "VersionId",
              "IsCurrentVersion",
              "Metadata"
            ]
          },
          "destination": "container1",
          "enabled": true
        },
        {
          "name": "inventoryPolicyRule2",
          "definition": {
            "format": "Parquet",
            "objectType": "Container",
            "schedule": "Weekly",
            "schemaFields": [
              "Name",
              "Last-Modified",
              "Metadata",
              "LeaseStatus",
              "LeaseState",
              "LeaseDuration",
              "PublicAccess",
              "HasImmutabilityPolicy",
              "HasLegalHold"
            ]
          },
          "destination": "container2",
          "enabled": true
        }
      ]
    }
  }
}

Sample response

{
  "name": "DefaultInventoryPolicy",
  "type": "Microsoft.Storage/storageAccounts/inventoryPolicies",
  "id": "/subscriptions/{subscription-id}/resourceGroups/res7687/providers/Microsoft.Storage/storageAccounts/sto9699/inventoryPolicies/default",
  "properties": {
    "lastModifiedTime": "2020-10-05T02:53:39.0932539Z",
    "policy": {
      "type": "Inventory",
      "enabled": true,
      "rules": [
        {
          "name": "inventoryPolicyRule1",
          "definition": {
            "format": "Csv",
            "filters": {
              "blobTypes": [
                "blockBlob",
                "appendBlob",
                "pageBlob"
              ],
              "creationTime": {
                "lastNDays": 1000
              },
              "includeBlobVersions": true,
              "includeSnapshots": true,
              "prefixMatch": [
                "inventoryprefix1",
                "inventoryprefix2"
              ]
            },
            "objectType": "Blob",
            "schedule": "Daily",
            "schemaFields": [
              "Name",
              "Creation-Time",
              "Last-Modified",
              "Content-Length",
              "Content-MD5",
              "BlobType",
              "AccessTier",
              "AccessTierChangeTime",
              "Snapshot",
              "VersionId",
              "IsCurrentVersion",
              "Metadata"
            ]
          },
          "destination": "container1",
          "enabled": true
        },
        {
          "name": "inventoryPolicyRule2",
          "definition": {
            "format": "Parquet",
            "objectType": "Container",
            "schedule": "Weekly",
            "schemaFields": [
              "Name",
              "Last-Modified",
              "Metadata",
              "LeaseStatus",
              "LeaseState",
              "LeaseDuration",
              "PublicAccess",
              "HasImmutabilityPolicy",
              "HasLegalHold"
            ]
          },
          "destination": "container2",
          "enabled": true
        }
      ]
    }
  }
}

StorageAccountSetBlobInventoryPolicyIncludeDeleteAndNewSchemaForHnsAccount

Sample request

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/res7687/providers/Microsoft.Storage/storageAccounts/sto9699/inventoryPolicies/default?api-version=2026-04-01

{
  "properties": {
    "policy": {
      "type": "Inventory",
      "enabled": true,
      "rules": [
        {
          "name": "inventoryPolicyRule1",
          "definition": {
            "format": "Csv",
            "filters": {
              "blobTypes": [
                "blockBlob",
                "appendBlob",
                "pageBlob"
              ],
              "excludePrefix": [
                "excludeprefix1",
                "excludeprefix2"
              ],
              "includeBlobVersions": true,
              "includeDeleted": true,
              "includeSnapshots": true,
              "prefixMatch": [
                "inventoryprefix1",
                "inventoryprefix2"
              ]
            },
            "objectType": "Blob",
            "schedule": "Daily",
            "schemaFields": [
              "Name",
              "Creation-Time",
              "Last-Modified",
              "Content-Length",
              "Content-MD5",
              "BlobType",
              "AccessTier",
              "AccessTierChangeTime",
              "Snapshot",
              "VersionId",
              "IsCurrentVersion",
              "ContentType",
              "ContentEncoding",
              "ContentLanguage",
              "ContentCRC64",
              "CacheControl",
              "Metadata",
              "DeletionId",
              "Deleted",
              "DeletedTime",
              "RemainingRetentionDays"
            ]
          },
          "destination": "container1",
          "enabled": true
        },
        {
          "name": "inventoryPolicyRule2",
          "definition": {
            "format": "Parquet",
            "objectType": "Container",
            "schedule": "Weekly",
            "schemaFields": [
              "Name",
              "Last-Modified",
              "Metadata",
              "LeaseStatus",
              "LeaseState",
              "LeaseDuration",
              "PublicAccess",
              "HasImmutabilityPolicy",
              "HasLegalHold",
              "Etag",
              "DefaultEncryptionScope",
              "DenyEncryptionScopeOverride",
              "ImmutableStorageWithVersioningEnabled",
              "Deleted",
              "Version",
              "DeletedTime",
              "RemainingRetentionDays"
            ]
          },
          "destination": "container2",
          "enabled": true
        }
      ]
    }
  }
}

Sample response

{
  "name": "DefaultInventoryPolicy",
  "type": "Microsoft.Storage/storageAccounts/inventoryPolicies",
  "id": "/subscriptions/{subscription-id}/resourceGroups/res7687/providers/Microsoft.Storage/storageAccounts/sto9699/inventoryPolicies/default",
  "properties": {
    "policy": {
      "type": "Inventory",
      "enabled": true,
      "rules": [
        {
          "name": "inventoryPolicyRule1",
          "definition": {
            "format": "Csv",
            "filters": {
              "blobTypes": [
                "blockBlob",
                "appendBlob",
                "pageBlob"
              ],
              "excludePrefix": [
                "excludeprefix1",
                "excludeprefix2"
              ],
              "includeBlobVersions": true,
              "includeDeleted": true,
              "includeSnapshots": true,
              "prefixMatch": [
                "inventoryprefix1",
                "inventoryprefix2"
              ]
            },
            "objectType": "Blob",
            "schedule": "Daily",
            "schemaFields": [
              "Name",
              "Creation-Time",
              "Last-Modified",
              "Content-Length",
              "Content-MD5",
              "BlobType",
              "AccessTier",
              "AccessTierChangeTime",
              "Snapshot",
              "VersionId",
              "IsCurrentVersion",
              "ContentType",
              "ContentEncoding",
              "ContentLanguage",
              "ContentCRC64",
              "CacheControl",
              "Metadata",
              "DeletionId",
              "Deleted",
              "DeletedTime",
              "RemainingRetentionDays"
            ]
          },
          "destination": "container1",
          "enabled": true
        },
        {
          "name": "inventoryPolicyRule2",
          "definition": {
            "format": "Parquet",
            "objectType": "Container",
            "schedule": "Weekly",
            "schemaFields": [
              "Name",
              "Last-Modified",
              "Metadata",
              "LeaseStatus",
              "LeaseState",
              "LeaseDuration",
              "PublicAccess",
              "HasImmutabilityPolicy",
              "HasLegalHold",
              "Etag",
              "DefaultEncryptionScope",
              "DenyEncryptionScopeOverride",
              "ImmutableStorageWithVersioningEnabled",
              "Deleted",
              "Version",
              "DeletedTime",
              "RemainingRetentionDays"
            ]
          },
          "destination": "container2",
          "enabled": true
        }
      ]
    }
  }
}

StorageAccountSetBlobInventoryPolicyIncludeDeleteAndNewSchemaForNonHnsAccount

Sample request

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/res7687/providers/Microsoft.Storage/storageAccounts/sto9699/inventoryPolicies/default?api-version=2026-04-01

{
  "properties": {
    "policy": {
      "type": "Inventory",
      "enabled": true,
      "rules": [
        {
          "name": "inventoryPolicyRule1",
          "definition": {
            "format": "Csv",
            "filters": {
              "blobTypes": [
                "blockBlob",
                "appendBlob",
                "pageBlob"
              ],
              "excludePrefix": [
                "excludeprefix1",
                "excludeprefix2"
              ],
              "includeBlobVersions": true,
              "includeDeleted": true,
              "includeSnapshots": true,
              "prefixMatch": [
                "inventoryprefix1",
                "inventoryprefix2"
              ]
            },
            "objectType": "Blob",
            "schedule": "Daily",
            "schemaFields": [
              "Name",
              "Creation-Time",
              "Last-Modified",
              "Content-Length",
              "Content-MD5",
              "BlobType",
              "AccessTier",
              "AccessTierChangeTime",
              "Snapshot",
              "VersionId",
              "IsCurrentVersion",
              "Tags",
              "ContentType",
              "ContentEncoding",
              "ContentLanguage",
              "ContentCRC64",
              "CacheControl",
              "Metadata",
              "Deleted",
              "RemainingRetentionDays"
            ]
          },
          "destination": "container1",
          "enabled": true
        },
        {
          "name": "inventoryPolicyRule2",
          "definition": {
            "format": "Parquet",
            "objectType": "Container",
            "schedule": "Weekly",
            "schemaFields": [
              "Name",
              "Last-Modified",
              "Metadata",
              "LeaseStatus",
              "LeaseState",
              "LeaseDuration",
              "PublicAccess",
              "HasImmutabilityPolicy",
              "HasLegalHold",
              "Etag",
              "DefaultEncryptionScope",
              "DenyEncryptionScopeOverride",
              "ImmutableStorageWithVersioningEnabled",
              "Deleted",
              "Version",
              "DeletedTime",
              "RemainingRetentionDays"
            ]
          },
          "destination": "container2",
          "enabled": true
        }
      ]
    }
  }
}

Sample response

{
  "name": "DefaultInventoryPolicy",
  "type": "Microsoft.Storage/storageAccounts/inventoryPolicies",
  "id": "/subscriptions/{subscription-id}/resourceGroups/res7687/providers/Microsoft.Storage/storageAccounts/sto9699/inventoryPolicies/default",
  "properties": {
    "policy": {
      "type": "Inventory",
      "enabled": true,
      "rules": [
        {
          "name": "inventoryPolicyRule1",
          "definition": {
            "format": "Csv",
            "filters": {
              "blobTypes": [
                "blockBlob",
                "appendBlob",
                "pageBlob"
              ],
              "excludePrefix": [
                "excludeprefix1",
                "excludeprefix2"
              ],
              "includeBlobVersions": true,
              "includeDeleted": true,
              "includeSnapshots": true,
              "prefixMatch": [
                "inventoryprefix1",
                "inventoryprefix2"
              ]
            },
            "objectType": "Blob",
            "schedule": "Daily",
            "schemaFields": [
              "Name",
              "Creation-Time",
              "Last-Modified",
              "Content-Length",
              "Content-MD5",
              "BlobType",
              "AccessTier",
              "AccessTierChangeTime",
              "Snapshot",
              "VersionId",
              "IsCurrentVersion",
              "Tags",
              "ContentType",
              "ContentEncoding",
              "ContentLanguage",
              "ContentCRC64",
              "CacheControl",
              "Metadata",
              "Deleted",
              "RemainingRetentionDays"
            ]
          },
          "destination": "container1",
          "enabled": true
        },
        {
          "name": "inventoryPolicyRule2",
          "definition": {
            "format": "Parquet",
            "objectType": "Container",
            "schedule": "Weekly",
            "schemaFields": [
              "Name",
              "Last-Modified",
              "Metadata",
              "LeaseStatus",
              "LeaseState",
              "LeaseDuration",
              "PublicAccess",
              "HasImmutabilityPolicy",
              "HasLegalHold",
              "Etag",
              "DefaultEncryptionScope",
              "DenyEncryptionScopeOverride",
              "ImmutableStorageWithVersioningEnabled",
              "Deleted",
              "Version",
              "DeletedTime",
              "RemainingRetentionDays"
            ]
          },
          "destination": "container2",
          "enabled": true
        }
      ]
    }
  }
}

Definitions

Name Description
BlobInventoryCreationTime

This property defines the creation time based filtering condition. Blob Inventory schema parameter 'Creation-Time' is mandatory with this filter.

BlobInventoryPolicy

The storage account blob inventory policy.

BlobInventoryPolicyDefinition

An object that defines the blob inventory rule.

BlobInventoryPolicyFilter

An object that defines the blob inventory rule filter conditions. For 'Blob' definition.objectType all filter properties are applicable, 'blobTypes' is required and others are optional. For 'Container' definition.objectType only prefixMatch is applicable and is optional.

BlobInventoryPolicyName

The name of the storage account blob inventory policy. It should always be 'default'

BlobInventoryPolicyRule

An object that wraps the blob inventory rule. Each rule is uniquely defined by name.

BlobInventoryPolicySchema

The storage account blob inventory policy rules.

CloudError

An error response from the Storage service.

CloudErrorBody

An error response from the Storage service.

createdByType

The type of identity that created the resource.

Format

This is a required field, it specifies the format for the inventory files.

InventoryRuleType

The valid value is Inventory

ObjectType

This is a required field. This field specifies the scope of the inventory created either at the blob or container level.

Schedule

This is a required field. This field is used to schedule an inventory formation.

systemData

Metadata pertaining to creation and last modification of the resource.

BlobInventoryCreationTime

This property defines the creation time based filtering condition. Blob Inventory schema parameter 'Creation-Time' is mandatory with this filter.

Name Type Description
lastNDays

integer (int32)

minimum: 1
maximum: 36500

When set the policy filters the objects that are created in the last N days. Where N is an integer value between 1 to 36500.

BlobInventoryPolicy

The storage account blob inventory policy.

Name Type Description
id

string (arm-id)

Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"

name

string

The name of the resource

properties.lastModifiedTime

string (date-time)

Returns the last modified date and time of the blob inventory policy.

properties.policy

BlobInventoryPolicySchema

The storage account blob inventory policy object. It is composed of policy rules.

systemData

systemData

Azure Resource Manager metadata containing createdBy and modifiedBy information.

type

string

The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"

BlobInventoryPolicyDefinition

An object that defines the blob inventory rule.

Name Type Description
filters

BlobInventoryPolicyFilter

An object that defines the filter set.

format

Format

This is a required field, it specifies the format for the inventory files.

objectType

ObjectType

This is a required field. This field specifies the scope of the inventory created either at the blob or container level.

schedule

Schedule

This is a required field. This field is used to schedule an inventory formation.

schemaFields

string[]

This is a required field. This field specifies the fields and properties of the object to be included in the inventory. The Schema field value 'Name' is always required. The valid values for this field for the 'Blob' definition.objectType include 'Name, Creation-Time, Last-Modified, Content-Length, Content-MD5, BlobType, AccessTier, AccessTierChangeTime, AccessTierInferred, Tags, Expiry-Time, hdi_isfolder, Owner, Group, Permissions, Acl, Snapshot, VersionId, IsCurrentVersion, Metadata, LastAccessTime, Tags, Etag, ContentType, ContentEncoding, ContentLanguage, ContentCRC64, CacheControl, ContentDisposition, LeaseStatus, LeaseState, LeaseDuration, ServerEncrypted, Deleted, DeletionId, DeletedTime, RemainingRetentionDays, ImmutabilityPolicyUntilDate, ImmutabilityPolicyMode, LegalHold, CopyId, CopyStatus, CopySource, CopyProgress, CopyCompletionTime, CopyStatusDescription, CustomerProvidedKeySha256, RehydratePriority, ArchiveStatus, XmsBlobSequenceNumber, EncryptionScope, IncrementalCopy, TagCount'. For Blob object type schema field value 'DeletedTime' is applicable only for Hns enabled accounts. The valid values for 'Container' definition.objectType include 'Name, Last-Modified, Metadata, LeaseStatus, LeaseState, LeaseDuration, PublicAccess, HasImmutabilityPolicy, HasLegalHold, Etag, DefaultEncryptionScope, DenyEncryptionScopeOverride, ImmutableStorageWithVersioningEnabled, Deleted, Version, DeletedTime, RemainingRetentionDays'. Schema field values 'Expiry-Time, hdi_isfolder, Owner, Group, Permissions, Acl, DeletionId' are valid only for Hns enabled accounts.Schema field values 'Tags, TagCount' are only valid for Non-Hns accounts.

BlobInventoryPolicyFilter

An object that defines the blob inventory rule filter conditions. For 'Blob' definition.objectType all filter properties are applicable, 'blobTypes' is required and others are optional. For 'Container' definition.objectType only prefixMatch is applicable and is optional.

Name Type Description
blobTypes

string[]

An array of predefined enum values. Valid values include blockBlob, appendBlob, pageBlob. Hns accounts does not support pageBlobs. This field is required when definition.objectType property is set to 'Blob'.

creationTime

BlobInventoryCreationTime

This property is used to filter objects based on the object creation time

excludePrefix

string[]

An array of strings with maximum 10 blob prefixes to be excluded from the inventory.

includeBlobVersions

boolean

Includes blob versions in blob inventory when value is set to true. The definition.schemaFields values 'VersionId and IsCurrentVersion' are required if this property is set to true, else they must be excluded.

includeDeleted

boolean

For 'Container' definition.objectType the definition.schemaFields must include 'Deleted, Version, DeletedTime and RemainingRetentionDays'. For 'Blob' definition.objectType and HNS enabled storage accounts the definition.schemaFields must include 'DeletionId, Deleted, DeletedTime and RemainingRetentionDays' and for Hns disabled accounts the definition.schemaFields must include 'Deleted and RemainingRetentionDays', else it must be excluded.

includeSnapshots

boolean

Includes blob snapshots in blob inventory when value is set to true. The definition.schemaFields value 'Snapshot' is required if this property is set to true, else it must be excluded.

prefixMatch

string[]

An array of strings with maximum 10 blob prefixes to be included in the inventory.

BlobInventoryPolicyName

The name of the storage account blob inventory policy. It should always be 'default'

Value Description
default

BlobInventoryPolicyRule

An object that wraps the blob inventory rule. Each rule is uniquely defined by name.

Name Type Description
definition

BlobInventoryPolicyDefinition

An object that defines the blob inventory policy rule.

destination

string

Container name where blob inventory files are stored. Must be pre-created.

enabled

boolean

Rule is enabled when set to true.

name

string

A rule name can contain any combination of alpha numeric characters. Rule name is case-sensitive. It must be unique within a policy.

BlobInventoryPolicySchema

The storage account blob inventory policy rules.

Name Type Description
destination

string

Deprecated Property from API version 2021-04-01 onwards, the required destination container name must be specified at the rule level 'policy.rule.destination'

enabled

boolean

Policy is enabled if set to true.

rules

BlobInventoryPolicyRule[]

The storage account blob inventory policy rules. The rule is applied when it is enabled.

type

InventoryRuleType

The valid value is Inventory

CloudError

An error response from the Storage service.

Name Type Description
error

CloudErrorBody

An error response from the Storage service.

CloudErrorBody

An error response from the Storage service.

Name Type Description
code

string

An identifier for the error. Codes are invariant and are intended to be consumed programmatically.

details

CloudErrorBody[]

A list of additional details about the error.

message

string

A message describing the error, intended to be suitable for display in a user interface.

target

string

The target of the particular error. For example, the name of the property in error.

createdByType

The type of identity that created the resource.

Value Description
User
Application
ManagedIdentity
Key

Format

This is a required field, it specifies the format for the inventory files.

Value Description
Csv
Parquet

InventoryRuleType

The valid value is Inventory

Value Description
Inventory

ObjectType

This is a required field. This field specifies the scope of the inventory created either at the blob or container level.

Value Description
Blob
Container

Schedule

This is a required field. This field is used to schedule an inventory formation.

Value Description
Daily
Weekly

systemData

Metadata pertaining to creation and last modification of the resource.

Name Type Description
createdAt

string (date-time)

The timestamp of resource creation (UTC).

createdBy

string

The identity that created the resource.

createdByType

createdByType

The type of identity that created the resource.

lastModifiedAt

string (date-time)

The timestamp of resource last modification (UTC)

lastModifiedBy

string

The identity that last modified the resource.

lastModifiedByType

createdByType

The type of identity that last modified the resource.