azure logo
Azure Classic v5.38.0, Mar 21 23

azure.storage.BlobInventoryPolicy

Manages a Storage Blob Inventory Policy.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new()
    {
        Location = "West Europe",
    });

    var exampleAccount = new Azure.Storage.Account("exampleAccount", new()
    {
        ResourceGroupName = exampleResourceGroup.Name,
        Location = exampleResourceGroup.Location,
        AccountTier = "Standard",
        AccountReplicationType = "LRS",
        BlobProperties = new Azure.Storage.Inputs.AccountBlobPropertiesArgs
        {
            VersioningEnabled = true,
        },
    });

    var exampleContainer = new Azure.Storage.Container("exampleContainer", new()
    {
        StorageAccountName = exampleAccount.Name,
        ContainerAccessType = "private",
    });

    var exampleBlobInventoryPolicy = new Azure.Storage.BlobInventoryPolicy("exampleBlobInventoryPolicy", new()
    {
        StorageAccountId = exampleAccount.Id,
        Rules = new[]
        {
            new Azure.Storage.Inputs.BlobInventoryPolicyRuleArgs
            {
                Name = "rule1",
                StorageContainerName = exampleContainer.Name,
                Format = "Csv",
                Schedule = "Daily",
                Scope = "Container",
                SchemaFields = new[]
                {
                    "Name",
                    "Last-Modified",
                },
            },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		exampleAccount, err := storage.NewAccount(ctx, "exampleAccount", &storage.AccountArgs{
			ResourceGroupName:      exampleResourceGroup.Name,
			Location:               exampleResourceGroup.Location,
			AccountTier:            pulumi.String("Standard"),
			AccountReplicationType: pulumi.String("LRS"),
			BlobProperties: &storage.AccountBlobPropertiesArgs{
				VersioningEnabled: pulumi.Bool(true),
			},
		})
		if err != nil {
			return err
		}
		exampleContainer, err := storage.NewContainer(ctx, "exampleContainer", &storage.ContainerArgs{
			StorageAccountName:  exampleAccount.Name,
			ContainerAccessType: pulumi.String("private"),
		})
		if err != nil {
			return err
		}
		_, err = storage.NewBlobInventoryPolicy(ctx, "exampleBlobInventoryPolicy", &storage.BlobInventoryPolicyArgs{
			StorageAccountId: exampleAccount.ID(),
			Rules: storage.BlobInventoryPolicyRuleArray{
				&storage.BlobInventoryPolicyRuleArgs{
					Name:                 pulumi.String("rule1"),
					StorageContainerName: exampleContainer.Name,
					Format:               pulumi.String("Csv"),
					Schedule:             pulumi.String("Daily"),
					Scope:                pulumi.String("Container"),
					SchemaFields: pulumi.StringArray{
						pulumi.String("Name"),
						pulumi.String("Last-Modified"),
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.storage.Account;
import com.pulumi.azure.storage.AccountArgs;
import com.pulumi.azure.storage.inputs.AccountBlobPropertiesArgs;
import com.pulumi.azure.storage.Container;
import com.pulumi.azure.storage.ContainerArgs;
import com.pulumi.azure.storage.BlobInventoryPolicy;
import com.pulumi.azure.storage.BlobInventoryPolicyArgs;
import com.pulumi.azure.storage.inputs.BlobInventoryPolicyRuleArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()        
            .location("West Europe")
            .build());

        var exampleAccount = new Account("exampleAccount", AccountArgs.builder()        
            .resourceGroupName(exampleResourceGroup.name())
            .location(exampleResourceGroup.location())
            .accountTier("Standard")
            .accountReplicationType("LRS")
            .blobProperties(AccountBlobPropertiesArgs.builder()
                .versioningEnabled(true)
                .build())
            .build());

        var exampleContainer = new Container("exampleContainer", ContainerArgs.builder()        
            .storageAccountName(exampleAccount.name())
            .containerAccessType("private")
            .build());

        var exampleBlobInventoryPolicy = new BlobInventoryPolicy("exampleBlobInventoryPolicy", BlobInventoryPolicyArgs.builder()        
            .storageAccountId(exampleAccount.id())
            .rules(BlobInventoryPolicyRuleArgs.builder()
                .name("rule1")
                .storageContainerName(exampleContainer.name())
                .format("Csv")
                .schedule("Daily")
                .scope("Container")
                .schemaFields(                
                    "Name",
                    "Last-Modified")
                .build())
            .build());

    }
}
import pulumi
import pulumi_azure as azure

example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_account = azure.storage.Account("exampleAccount",
    resource_group_name=example_resource_group.name,
    location=example_resource_group.location,
    account_tier="Standard",
    account_replication_type="LRS",
    blob_properties=azure.storage.AccountBlobPropertiesArgs(
        versioning_enabled=True,
    ))
example_container = azure.storage.Container("exampleContainer",
    storage_account_name=example_account.name,
    container_access_type="private")
example_blob_inventory_policy = azure.storage.BlobInventoryPolicy("exampleBlobInventoryPolicy",
    storage_account_id=example_account.id,
    rules=[azure.storage.BlobInventoryPolicyRuleArgs(
        name="rule1",
        storage_container_name=example_container.name,
        format="Csv",
        schedule="Daily",
        scope="Container",
        schema_fields=[
            "Name",
            "Last-Modified",
        ],
    )])
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const exampleAccount = new azure.storage.Account("exampleAccount", {
    resourceGroupName: exampleResourceGroup.name,
    location: exampleResourceGroup.location,
    accountTier: "Standard",
    accountReplicationType: "LRS",
    blobProperties: {
        versioningEnabled: true,
    },
});
const exampleContainer = new azure.storage.Container("exampleContainer", {
    storageAccountName: exampleAccount.name,
    containerAccessType: "private",
});
const exampleBlobInventoryPolicy = new azure.storage.BlobInventoryPolicy("exampleBlobInventoryPolicy", {
    storageAccountId: exampleAccount.id,
    rules: [{
        name: "rule1",
        storageContainerName: exampleContainer.name,
        format: "Csv",
        schedule: "Daily",
        scope: "Container",
        schemaFields: [
            "Name",
            "Last-Modified",
        ],
    }],
});
resources:
  exampleResourceGroup:
    type: azure:core:ResourceGroup
    properties:
      location: West Europe
  exampleAccount:
    type: azure:storage:Account
    properties:
      resourceGroupName: ${exampleResourceGroup.name}
      location: ${exampleResourceGroup.location}
      accountTier: Standard
      accountReplicationType: LRS
      blobProperties:
        versioningEnabled: true
  exampleContainer:
    type: azure:storage:Container
    properties:
      storageAccountName: ${exampleAccount.name}
      containerAccessType: private
  exampleBlobInventoryPolicy:
    type: azure:storage:BlobInventoryPolicy
    properties:
      storageAccountId: ${exampleAccount.id}
      rules:
        - name: rule1
          storageContainerName: ${exampleContainer.name}
          format: Csv
          schedule: Daily
          scope: Container
          schemaFields:
            - Name
            - Last-Modified

Create BlobInventoryPolicy Resource

new BlobInventoryPolicy(name: string, args: BlobInventoryPolicyArgs, opts?: CustomResourceOptions);
@overload
def BlobInventoryPolicy(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        rules: Optional[Sequence[BlobInventoryPolicyRuleArgs]] = None,
                        storage_account_id: Optional[str] = None)
@overload
def BlobInventoryPolicy(resource_name: str,
                        args: BlobInventoryPolicyArgs,
                        opts: Optional[ResourceOptions] = None)
func NewBlobInventoryPolicy(ctx *Context, name string, args BlobInventoryPolicyArgs, opts ...ResourceOption) (*BlobInventoryPolicy, error)
public BlobInventoryPolicy(string name, BlobInventoryPolicyArgs args, CustomResourceOptions? opts = null)
public BlobInventoryPolicy(String name, BlobInventoryPolicyArgs args)
public BlobInventoryPolicy(String name, BlobInventoryPolicyArgs args, CustomResourceOptions options)
type: azure:storage:BlobInventoryPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args BlobInventoryPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args BlobInventoryPolicyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args BlobInventoryPolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args BlobInventoryPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args BlobInventoryPolicyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

BlobInventoryPolicy Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The BlobInventoryPolicy resource accepts the following input properties:

Rules List<BlobInventoryPolicyRuleArgs>

One or more rules blocks as defined below.

StorageAccountId string

The ID of the storage account to apply this Blob Inventory Policy to. Changing this forces a new Storage Blob Inventory Policy to be created.

Rules []BlobInventoryPolicyRuleArgs

One or more rules blocks as defined below.

StorageAccountId string

The ID of the storage account to apply this Blob Inventory Policy to. Changing this forces a new Storage Blob Inventory Policy to be created.

rules List<BlobInventoryPolicyRuleArgs>

One or more rules blocks as defined below.

storageAccountId String

The ID of the storage account to apply this Blob Inventory Policy to. Changing this forces a new Storage Blob Inventory Policy to be created.

rules BlobInventoryPolicyRuleArgs[]

One or more rules blocks as defined below.

storageAccountId string

The ID of the storage account to apply this Blob Inventory Policy to. Changing this forces a new Storage Blob Inventory Policy to be created.

rules Sequence[BlobInventoryPolicyRuleArgs]

One or more rules blocks as defined below.

storage_account_id str

The ID of the storage account to apply this Blob Inventory Policy to. Changing this forces a new Storage Blob Inventory Policy to be created.

rules List<Property Map>

One or more rules blocks as defined below.

storageAccountId String

The ID of the storage account to apply this Blob Inventory Policy to. Changing this forces a new Storage Blob Inventory Policy to be created.

Outputs

All input properties are implicitly available as output properties. Additionally, the BlobInventoryPolicy resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing BlobInventoryPolicy Resource

Get an existing BlobInventoryPolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: BlobInventoryPolicyState, opts?: CustomResourceOptions): BlobInventoryPolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        rules: Optional[Sequence[BlobInventoryPolicyRuleArgs]] = None,
        storage_account_id: Optional[str] = None) -> BlobInventoryPolicy
func GetBlobInventoryPolicy(ctx *Context, name string, id IDInput, state *BlobInventoryPolicyState, opts ...ResourceOption) (*BlobInventoryPolicy, error)
public static BlobInventoryPolicy Get(string name, Input<string> id, BlobInventoryPolicyState? state, CustomResourceOptions? opts = null)
public static BlobInventoryPolicy get(String name, Output<String> id, BlobInventoryPolicyState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Rules List<BlobInventoryPolicyRuleArgs>

One or more rules blocks as defined below.

StorageAccountId string

The ID of the storage account to apply this Blob Inventory Policy to. Changing this forces a new Storage Blob Inventory Policy to be created.

Rules []BlobInventoryPolicyRuleArgs

One or more rules blocks as defined below.

StorageAccountId string

The ID of the storage account to apply this Blob Inventory Policy to. Changing this forces a new Storage Blob Inventory Policy to be created.

rules List<BlobInventoryPolicyRuleArgs>

One or more rules blocks as defined below.

storageAccountId String

The ID of the storage account to apply this Blob Inventory Policy to. Changing this forces a new Storage Blob Inventory Policy to be created.

rules BlobInventoryPolicyRuleArgs[]

One or more rules blocks as defined below.

storageAccountId string

The ID of the storage account to apply this Blob Inventory Policy to. Changing this forces a new Storage Blob Inventory Policy to be created.

rules Sequence[BlobInventoryPolicyRuleArgs]

One or more rules blocks as defined below.

storage_account_id str

The ID of the storage account to apply this Blob Inventory Policy to. Changing this forces a new Storage Blob Inventory Policy to be created.

rules List<Property Map>

One or more rules blocks as defined below.

storageAccountId String

The ID of the storage account to apply this Blob Inventory Policy to. Changing this forces a new Storage Blob Inventory Policy to be created.

Supporting Types

BlobInventoryPolicyRule

Format string

The format of the inventory files. Possible values are Csv and Parquet.

Name string

The name which should be used for this Blob Inventory Policy Rule.

Schedule string

The inventory schedule applied by this rule. Possible values are Daily and Weekly.

SchemaFields List<string>

A list of fields to be included in the inventory. See the Azure API reference for all the supported fields.

Scope string

The scope of the inventory for this rule. Possible values are Blob and Container.

StorageContainerName string

The storage container name to store the blob inventory files for this rule.

Filter BlobInventoryPolicyRuleFilter

A filter block as defined above. Can only be set when the scope is Blob.

Format string

The format of the inventory files. Possible values are Csv and Parquet.

Name string

The name which should be used for this Blob Inventory Policy Rule.

Schedule string

The inventory schedule applied by this rule. Possible values are Daily and Weekly.

SchemaFields []string

A list of fields to be included in the inventory. See the Azure API reference for all the supported fields.

Scope string

The scope of the inventory for this rule. Possible values are Blob and Container.

StorageContainerName string

The storage container name to store the blob inventory files for this rule.

Filter BlobInventoryPolicyRuleFilter

A filter block as defined above. Can only be set when the scope is Blob.

format String

The format of the inventory files. Possible values are Csv and Parquet.

name String

The name which should be used for this Blob Inventory Policy Rule.

schedule String

The inventory schedule applied by this rule. Possible values are Daily and Weekly.

schemaFields List<String>

A list of fields to be included in the inventory. See the Azure API reference for all the supported fields.

scope String

The scope of the inventory for this rule. Possible values are Blob and Container.

storageContainerName String

The storage container name to store the blob inventory files for this rule.

filter BlobInventoryPolicyRuleFilter

A filter block as defined above. Can only be set when the scope is Blob.

format string

The format of the inventory files. Possible values are Csv and Parquet.

name string

The name which should be used for this Blob Inventory Policy Rule.

schedule string

The inventory schedule applied by this rule. Possible values are Daily and Weekly.

schemaFields string[]

A list of fields to be included in the inventory. See the Azure API reference for all the supported fields.

scope string

The scope of the inventory for this rule. Possible values are Blob and Container.

storageContainerName string

The storage container name to store the blob inventory files for this rule.

filter BlobInventoryPolicyRuleFilter

A filter block as defined above. Can only be set when the scope is Blob.

format str

The format of the inventory files. Possible values are Csv and Parquet.

name str

The name which should be used for this Blob Inventory Policy Rule.

schedule str

The inventory schedule applied by this rule. Possible values are Daily and Weekly.

schema_fields Sequence[str]

A list of fields to be included in the inventory. See the Azure API reference for all the supported fields.

scope str

The scope of the inventory for this rule. Possible values are Blob and Container.

storage_container_name str

The storage container name to store the blob inventory files for this rule.

filter BlobInventoryPolicyRuleFilter

A filter block as defined above. Can only be set when the scope is Blob.

format String

The format of the inventory files. Possible values are Csv and Parquet.

name String

The name which should be used for this Blob Inventory Policy Rule.

schedule String

The inventory schedule applied by this rule. Possible values are Daily and Weekly.

schemaFields List<String>

A list of fields to be included in the inventory. See the Azure API reference for all the supported fields.

scope String

The scope of the inventory for this rule. Possible values are Blob and Container.

storageContainerName String

The storage container name to store the blob inventory files for this rule.

filter Property Map

A filter block as defined above. Can only be set when the scope is Blob.

BlobInventoryPolicyRuleFilter

BlobTypes List<string>

A set of blob types. Possible values are blockBlob, appendBlob, and pageBlob. The storage account with is_hns_enabled is true doesn't support pageBlob.

ExcludePrefixes List<string>

A set of strings for blob prefixes to be excluded. Maximum of 10 blob prefixes.

IncludeBlobVersions bool

Includes blob versions in blob inventory or not? Defaults to false.

IncludeDeleted bool

Includes deleted blobs in blob inventory or not? Defaults to false.

IncludeSnapshots bool

Includes blob snapshots in blob inventory or not? Defaults to false.

PrefixMatches List<string>

A set of strings for blob prefixes to be matched. Maximum of 10 blob prefixes.

BlobTypes []string

A set of blob types. Possible values are blockBlob, appendBlob, and pageBlob. The storage account with is_hns_enabled is true doesn't support pageBlob.

ExcludePrefixes []string

A set of strings for blob prefixes to be excluded. Maximum of 10 blob prefixes.

IncludeBlobVersions bool

Includes blob versions in blob inventory or not? Defaults to false.

IncludeDeleted bool

Includes deleted blobs in blob inventory or not? Defaults to false.

IncludeSnapshots bool

Includes blob snapshots in blob inventory or not? Defaults to false.

PrefixMatches []string

A set of strings for blob prefixes to be matched. Maximum of 10 blob prefixes.

blobTypes List<String>

A set of blob types. Possible values are blockBlob, appendBlob, and pageBlob. The storage account with is_hns_enabled is true doesn't support pageBlob.

excludePrefixes List<String>

A set of strings for blob prefixes to be excluded. Maximum of 10 blob prefixes.

includeBlobVersions Boolean

Includes blob versions in blob inventory or not? Defaults to false.

includeDeleted Boolean

Includes deleted blobs in blob inventory or not? Defaults to false.

includeSnapshots Boolean

Includes blob snapshots in blob inventory or not? Defaults to false.

prefixMatches List<String>

A set of strings for blob prefixes to be matched. Maximum of 10 blob prefixes.

blobTypes string[]

A set of blob types. Possible values are blockBlob, appendBlob, and pageBlob. The storage account with is_hns_enabled is true doesn't support pageBlob.

excludePrefixes string[]

A set of strings for blob prefixes to be excluded. Maximum of 10 blob prefixes.

includeBlobVersions boolean

Includes blob versions in blob inventory or not? Defaults to false.

includeDeleted boolean

Includes deleted blobs in blob inventory or not? Defaults to false.

includeSnapshots boolean

Includes blob snapshots in blob inventory or not? Defaults to false.

prefixMatches string[]

A set of strings for blob prefixes to be matched. Maximum of 10 blob prefixes.

blob_types Sequence[str]

A set of blob types. Possible values are blockBlob, appendBlob, and pageBlob. The storage account with is_hns_enabled is true doesn't support pageBlob.

exclude_prefixes Sequence[str]

A set of strings for blob prefixes to be excluded. Maximum of 10 blob prefixes.

include_blob_versions bool

Includes blob versions in blob inventory or not? Defaults to false.

include_deleted bool

Includes deleted blobs in blob inventory or not? Defaults to false.

include_snapshots bool

Includes blob snapshots in blob inventory or not? Defaults to false.

prefix_matches Sequence[str]

A set of strings for blob prefixes to be matched. Maximum of 10 blob prefixes.

blobTypes List<String>

A set of blob types. Possible values are blockBlob, appendBlob, and pageBlob. The storage account with is_hns_enabled is true doesn't support pageBlob.

excludePrefixes List<String>

A set of strings for blob prefixes to be excluded. Maximum of 10 blob prefixes.

includeBlobVersions Boolean

Includes blob versions in blob inventory or not? Defaults to false.

includeDeleted Boolean

Includes deleted blobs in blob inventory or not? Defaults to false.

includeSnapshots Boolean

Includes blob snapshots in blob inventory or not? Defaults to false.

prefixMatches List<String>

A set of strings for blob prefixes to be matched. Maximum of 10 blob prefixes.

Import

Storage Blob Inventory Policies can be imported using the resource id, e.g.

 $ pulumi import azure:storage/blobInventoryPolicy:BlobInventoryPolicy example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Storage/storageAccounts/storageAccount1/inventoryPolicies/inventoryPolicy1

Package Details

Repository
Azure Classic pulumi/pulumi-azure
License
Apache-2.0
Notes

This Pulumi package is based on the azurerm Terraform Provider.