Blob

Manages a Blob within a Storage Container.

Example Usage

using Pulumi;
using Azure = Pulumi.Azure;

class MyStack : Stack
{
    public MyStack()
    {
        var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
        {
            Location = "West Europe",
        });
        var exampleAccount = new Azure.Storage.Account("exampleAccount", new Azure.Storage.AccountArgs
        {
            ResourceGroupName = exampleResourceGroup.Name,
            Location = exampleResourceGroup.Location,
            AccountTier = "Standard",
            AccountReplicationType = "LRS",
        });
        var exampleContainer = new Azure.Storage.Container("exampleContainer", new Azure.Storage.ContainerArgs
        {
            StorageAccountName = exampleAccount.Name,
            ContainerAccessType = "private",
        });
        var exampleBlob = new Azure.Storage.Blob("exampleBlob", new Azure.Storage.BlobArgs
        {
            StorageAccountName = exampleAccount.Name,
            StorageContainerName = exampleContainer.Name,
            Type = "Block",
            Source = new FileAsset("some-local-file.zip"),
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-azure/sdk/v3/go/azure/core"
    "github.com/pulumi/pulumi-azure/sdk/v3/go/azure/storage"
    "github.com/pulumi/pulumi/sdk/v2/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"),
        })
        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.NewBlob(ctx, "exampleBlob", &storage.BlobArgs{
            StorageAccountName:   exampleAccount.Name,
            StorageContainerName: exampleContainer.Name,
            Type:                 pulumi.String("Block"),
            Source:               pulumi.NewFileAsset("some-local-file.zip"),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
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")
example_container = azure.storage.Container("exampleContainer",
    storage_account_name=example_account.name,
    container_access_type="private")
example_blob = azure.storage.Blob("exampleBlob",
    storage_account_name=example_account.name,
    storage_container_name=example_container.name,
    type="Block",
    source=pulumi.FileAsset("some-local-file.zip"))
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",
});
const exampleContainer = new azure.storage.Container("exampleContainer", {
    storageAccountName: exampleAccount.name,
    containerAccessType: "private",
});
const exampleBlob = new azure.storage.Blob("exampleBlob", {
    storageAccountName: exampleAccount.name,
    storageContainerName: exampleContainer.name,
    type: "Block",
    source: new pulumi.asset.FileAsset("some-local-file.zip"),
});

Create a Blob Resource

new Blob(name: string, args: BlobArgs, opts?: CustomResourceOptions);
def Blob(resource_name, opts=None, access_tier=None, content_type=None, metadata=None, name=None, parallelism=None, size=None, source=None, source_content=None, source_uri=None, storage_account_name=None, storage_container_name=None, type=None, __props__=None);
func NewBlob(ctx *Context, name string, args BlobArgs, opts ...ResourceOption) (*Blob, error)
public Blob(string name, BlobArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args BlobArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args BlobArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args BlobArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Blob Resource Properties

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

Inputs

The Blob resource accepts the following input properties:

StorageAccountName string

Specifies the storage account in which to create the storage container. Changing this forces a new resource to be created.

StorageContainerName string

The name of the storage container in which this blob should be created.

Type string

The type of the storage blob to be created. Possible values are Append, Block or Page. Changing this forces a new resource to be created.

AccessTier string

The access tier of the storage blob. Possible values are Archive, Cool and Hot.

ContentType string

The content type of the storage blob. Cannot be defined if source_uri is defined. Defaults to application/octet-stream.

Metadata Dictionary<string, string>

A map of custom blob metadata.

Name string

The name of the storage blob. Must be unique within the storage container the blob is located.

Parallelism int

The number of workers per CPU core to run for concurrent uploads. Defaults to 8.

Size int

Used only for page blobs to specify the size in bytes of the blob to be created. Must be a multiple of 512. Defaults to 0.

Source AssetOrArchive

An absolute path to a file on the local system. This field cannot be specified for Append blobs and cannot be specified if source_content or source_uri is specified.

SourceContent string

The content for this blob which should be defined inline. This field can only be specified for Block blobs and cannot be specified if source or source_uri is specified.

SourceUri string

The URI of an existing blob, or a file in the Azure File service, to use as the source contents for the blob to be created. Changing this forces a new resource to be created. This field cannot be specified for Append blobs and cannot be specified if source or source_content is specified.

StorageAccountName string

Specifies the storage account in which to create the storage container. Changing this forces a new resource to be created.

StorageContainerName string

The name of the storage container in which this blob should be created.

Type string

The type of the storage blob to be created. Possible values are Append, Block or Page. Changing this forces a new resource to be created.

AccessTier string

The access tier of the storage blob. Possible values are Archive, Cool and Hot.

ContentType string

The content type of the storage blob. Cannot be defined if source_uri is defined. Defaults to application/octet-stream.

Metadata map[string]string

A map of custom blob metadata.

Name string

The name of the storage blob. Must be unique within the storage container the blob is located.

Parallelism int

The number of workers per CPU core to run for concurrent uploads. Defaults to 8.

Size int

Used only for page blobs to specify the size in bytes of the blob to be created. Must be a multiple of 512. Defaults to 0.

Source pulumi.AssetOrArchive

An absolute path to a file on the local system. This field cannot be specified for Append blobs and cannot be specified if source_content or source_uri is specified.

SourceContent string

The content for this blob which should be defined inline. This field can only be specified for Block blobs and cannot be specified if source or source_uri is specified.

SourceUri string

The URI of an existing blob, or a file in the Azure File service, to use as the source contents for the blob to be created. Changing this forces a new resource to be created. This field cannot be specified for Append blobs and cannot be specified if source or source_content is specified.

storageAccountName string

Specifies the storage account in which to create the storage container. Changing this forces a new resource to be created.

storageContainerName string

The name of the storage container in which this blob should be created.

type string

The type of the storage blob to be created. Possible values are Append, Block or Page. Changing this forces a new resource to be created.

accessTier string

The access tier of the storage blob. Possible values are Archive, Cool and Hot.

contentType string

The content type of the storage blob. Cannot be defined if source_uri is defined. Defaults to application/octet-stream.

metadata {[key: string]: string}

A map of custom blob metadata.

name string

The name of the storage blob. Must be unique within the storage container the blob is located.

parallelism number

The number of workers per CPU core to run for concurrent uploads. Defaults to 8.

size number

Used only for page blobs to specify the size in bytes of the blob to be created. Must be a multiple of 512. Defaults to 0.

source pulumi.asset.Asset | pulumi.asset.Archive

An absolute path to a file on the local system. This field cannot be specified for Append blobs and cannot be specified if source_content or source_uri is specified.

sourceContent string

The content for this blob which should be defined inline. This field can only be specified for Block blobs and cannot be specified if source or source_uri is specified.

sourceUri string

The URI of an existing blob, or a file in the Azure File service, to use as the source contents for the blob to be created. Changing this forces a new resource to be created. This field cannot be specified for Append blobs and cannot be specified if source or source_content is specified.

storage_account_name str

Specifies the storage account in which to create the storage container. Changing this forces a new resource to be created.

storage_container_name str

The name of the storage container in which this blob should be created.

type str

The type of the storage blob to be created. Possible values are Append, Block or Page. Changing this forces a new resource to be created.

access_tier str

The access tier of the storage blob. Possible values are Archive, Cool and Hot.

content_type str

The content type of the storage blob. Cannot be defined if source_uri is defined. Defaults to application/octet-stream.

metadata Dict[str, str]

A map of custom blob metadata.

name str

The name of the storage blob. Must be unique within the storage container the blob is located.

parallelism float

The number of workers per CPU core to run for concurrent uploads. Defaults to 8.

size float

Used only for page blobs to specify the size in bytes of the blob to be created. Must be a multiple of 512. Defaults to 0.

source Union[pulumi.Asset, pulumi.Archive]

An absolute path to a file on the local system. This field cannot be specified for Append blobs and cannot be specified if source_content or source_uri is specified.

source_content str

The content for this blob which should be defined inline. This field can only be specified for Block blobs and cannot be specified if source or source_uri is specified.

source_uri str

The URI of an existing blob, or a file in the Azure File service, to use as the source contents for the blob to be created. Changing this forces a new resource to be created. This field cannot be specified for Append blobs and cannot be specified if source or source_content is specified.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Url string

The URL of the blob

Id string
The provider-assigned unique ID for this managed resource.
Url string

The URL of the blob

id string
The provider-assigned unique ID for this managed resource.
url string

The URL of the blob

id str
The provider-assigned unique ID for this managed resource.
url str

The URL of the blob

Look up an Existing Blob Resource

Get an existing Blob 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?: BlobState, opts?: CustomResourceOptions): Blob
static get(resource_name, id, opts=None, access_tier=None, content_type=None, metadata=None, name=None, parallelism=None, size=None, source=None, source_content=None, source_uri=None, storage_account_name=None, storage_container_name=None, type=None, url=None, __props__=None);
func GetBlob(ctx *Context, name string, id IDInput, state *BlobState, opts ...ResourceOption) (*Blob, error)
public static Blob Get(string name, Input<string> id, BlobState? state, CustomResourceOptions? opts = null)
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.

The following state arguments are supported:

AccessTier string

The access tier of the storage blob. Possible values are Archive, Cool and Hot.

ContentType string

The content type of the storage blob. Cannot be defined if source_uri is defined. Defaults to application/octet-stream.

Metadata Dictionary<string, string>

A map of custom blob metadata.

Name string

The name of the storage blob. Must be unique within the storage container the blob is located.

Parallelism int

The number of workers per CPU core to run for concurrent uploads. Defaults to 8.

Size int

Used only for page blobs to specify the size in bytes of the blob to be created. Must be a multiple of 512. Defaults to 0.

Source AssetOrArchive

An absolute path to a file on the local system. This field cannot be specified for Append blobs and cannot be specified if source_content or source_uri is specified.

SourceContent string

The content for this blob which should be defined inline. This field can only be specified for Block blobs and cannot be specified if source or source_uri is specified.

SourceUri string

The URI of an existing blob, or a file in the Azure File service, to use as the source contents for the blob to be created. Changing this forces a new resource to be created. This field cannot be specified for Append blobs and cannot be specified if source or source_content is specified.

StorageAccountName string

Specifies the storage account in which to create the storage container. Changing this forces a new resource to be created.

StorageContainerName string

The name of the storage container in which this blob should be created.

Type string

The type of the storage blob to be created. Possible values are Append, Block or Page. Changing this forces a new resource to be created.

Url string

The URL of the blob

AccessTier string

The access tier of the storage blob. Possible values are Archive, Cool and Hot.

ContentType string

The content type of the storage blob. Cannot be defined if source_uri is defined. Defaults to application/octet-stream.

Metadata map[string]string

A map of custom blob metadata.

Name string

The name of the storage blob. Must be unique within the storage container the blob is located.

Parallelism int

The number of workers per CPU core to run for concurrent uploads. Defaults to 8.

Size int

Used only for page blobs to specify the size in bytes of the blob to be created. Must be a multiple of 512. Defaults to 0.

Source pulumi.AssetOrArchive

An absolute path to a file on the local system. This field cannot be specified for Append blobs and cannot be specified if source_content or source_uri is specified.

SourceContent string

The content for this blob which should be defined inline. This field can only be specified for Block blobs and cannot be specified if source or source_uri is specified.

SourceUri string

The URI of an existing blob, or a file in the Azure File service, to use as the source contents for the blob to be created. Changing this forces a new resource to be created. This field cannot be specified for Append blobs and cannot be specified if source or source_content is specified.

StorageAccountName string

Specifies the storage account in which to create the storage container. Changing this forces a new resource to be created.

StorageContainerName string

The name of the storage container in which this blob should be created.

Type string

The type of the storage blob to be created. Possible values are Append, Block or Page. Changing this forces a new resource to be created.

Url string

The URL of the blob

accessTier string

The access tier of the storage blob. Possible values are Archive, Cool and Hot.

contentType string

The content type of the storage blob. Cannot be defined if source_uri is defined. Defaults to application/octet-stream.

metadata {[key: string]: string}

A map of custom blob metadata.

name string

The name of the storage blob. Must be unique within the storage container the blob is located.

parallelism number

The number of workers per CPU core to run for concurrent uploads. Defaults to 8.

size number

Used only for page blobs to specify the size in bytes of the blob to be created. Must be a multiple of 512. Defaults to 0.

source pulumi.asset.Asset | pulumi.asset.Archive

An absolute path to a file on the local system. This field cannot be specified for Append blobs and cannot be specified if source_content or source_uri is specified.

sourceContent string

The content for this blob which should be defined inline. This field can only be specified for Block blobs and cannot be specified if source or source_uri is specified.

sourceUri string

The URI of an existing blob, or a file in the Azure File service, to use as the source contents for the blob to be created. Changing this forces a new resource to be created. This field cannot be specified for Append blobs and cannot be specified if source or source_content is specified.

storageAccountName string

Specifies the storage account in which to create the storage container. Changing this forces a new resource to be created.

storageContainerName string

The name of the storage container in which this blob should be created.

type string

The type of the storage blob to be created. Possible values are Append, Block or Page. Changing this forces a new resource to be created.

url string

The URL of the blob

access_tier str

The access tier of the storage blob. Possible values are Archive, Cool and Hot.

content_type str

The content type of the storage blob. Cannot be defined if source_uri is defined. Defaults to application/octet-stream.

metadata Dict[str, str]

A map of custom blob metadata.

name str

The name of the storage blob. Must be unique within the storage container the blob is located.

parallelism float

The number of workers per CPU core to run for concurrent uploads. Defaults to 8.

size float

Used only for page blobs to specify the size in bytes of the blob to be created. Must be a multiple of 512. Defaults to 0.

source Union[pulumi.Asset, pulumi.Archive]

An absolute path to a file on the local system. This field cannot be specified for Append blobs and cannot be specified if source_content or source_uri is specified.

source_content str

The content for this blob which should be defined inline. This field can only be specified for Block blobs and cannot be specified if source or source_uri is specified.

source_uri str

The URI of an existing blob, or a file in the Azure File service, to use as the source contents for the blob to be created. Changing this forces a new resource to be created. This field cannot be specified for Append blobs and cannot be specified if source or source_content is specified.

storage_account_name str

Specifies the storage account in which to create the storage container. Changing this forces a new resource to be created.

storage_container_name str

The name of the storage container in which this blob should be created.

type str

The type of the storage blob to be created. Possible values are Append, Block or Page. Changing this forces a new resource to be created.

url str

The URL of the blob

Package Details

Repository
https://github.com/pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.