Set-AzureStorageBlobContent

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Set-AzureStorageBlobContent

Uploads a local file.

Parameter Set: SendManual
Set-AzureStorageBlobContent [-File] <String> [-Container] <String> [-Blob <String> ] [-BlobType <String> ] [-ConcurrentTaskCount <Int32> ] [-Context <AzureStorageContext> ] [-Force] [-Metadata <Hashtable> ] [-Properties <Hashtable> ] [ <CommonParameters>]

Parameter Set: BlobPipeline
Set-AzureStorageBlobContent [-File] <String> -ICloudBlob <ICloudBlob> [-BlobType <String> ] [-ConcurrentTaskCount <Int32> ] [-Context <AzureStorageContext> ] [-Force] [-Metadata <Hashtable> ] [-Properties <Hashtable> ] [ <CommonParameters>]

Parameter Set: ContainerPipeline
Set-AzureStorageBlobContent [-File] <String> -CloudBlobContainer <CloudBlobContainer> [-Blob <String> ] [-BlobType <String> ] [-ConcurrentTaskCount <Int32> ] [-Context <AzureStorageContext> ] [-Force] [-Metadata <Hashtable> ] [-Properties <Hashtable> ] [ <CommonParameters>]

This topic describes the cmdlet in the .6.19 version of the Windows Azure PowerShell module. To find out the version of the module you're using, from the Windows Azure PowerShell console, type (get-module azure).version.

Uploads a local file to a Windows Azure storage blob.

-Blob<String>

Specifies a blob name. If no name is specified, the file name is used as the blob name.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-BlobType<String>

Specifies the type of blob, either block or page. Block is the default.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CloudBlobContainer<CloudBlobContainer>

Specifies a CloudBlobContainer object from the Windows Azure Storage Client library. You can create it or use the Get-AzureStorageContainer cmdlet.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-ConcurrentTaskCount<Int32>

Specifies the concurrent network calls. By default if no value is specified for this paramater, this cmdlet initiates network calls up to eight times the number of cores available for concurrent tasks on your computer when you upload files to Windows Azure storage. For example, if your computer has four cores, the cmdlet initiates up to 32 (eight times of 4) network calls at one time. You can use this parameter to limit the concurrency to throttle local CPU and bandwidth usage by specifying the maximum number of concurrent network calls. The specified value is an absolute count and is not multiplied by the core count. For example, set ‘-ConcurrentTaskCount 1’ uploads or downloads in sequence without any parallel network request. This parameter can help mitigate network connection problems in low bandwidth environments, such as 100 kilobits per second.

Aliases

none

Required?

false

Position?

named

Default Value

ProcessorCount * 8

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Container<String>

Specifies the name of the container.

Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Context<AzureStorageContext>

Specifies the storage context for Windows Azure. You can use the New-AzureStorageContext cmdlet to create it.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-File<String>

Specifies the local path, either relative or absolute, to the file you want to upload.

Aliases

FullName

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Force

Force to overwrite the existing blob.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ICloudBlob<ICloudBlob>

Specifies an ICloudBlob object from the Windows Azure Storage Client library. You can create it or use the Get-AzureStorageBlob cmdlet.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Metadata<Hashtable>

Specifies metadata for the blob. For more information, see Set and Retrieve Properties and Metadata

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Properties<Hashtable>

Specifies properties for the blob. For more information, see Set and Retrieve Properties and Metadata

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see  about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

Upload a file by name

This example uploads a file by name.

C:\PS>Set-AzureStorageBlobContent -Container upload -File .\filename -Blob blobname

Upload a file using ls command

This example lists all files in a directory and its subdirectories, and then uploads the files.

C:\PS>ls -File -Recurse | Set-AzureStorageBlobContent -Container upload

Upload a file to a blob using the pipeline

This example gets a specific container and blob, and then uses the pipeline to upload a file to the specified blob.

C:\PS>Get-AzureStorageBlob -Container containername -Blob blobname | Set-AzureStorageBlobContent -File filename

Upload file to a container using pipeline

This example gets all containers whose name starts with ‘container’, and then uses the pipeline to upload a file to all the containers.

C:\PS>Get-AzureStorageContainer -Container container* | Set-AzureStorageBlobContent -File filename -Blob blobname

Upload file and set metadata

This example uploads a file and sets metadata for the blob.

C:\PS>$meta = @{"key" = "value"; "name" = "test"}Set-AzureStorageBlobContent -File filename -Container containername -Metadata $meta

Remove-AzureStorageBlob

Get-AzureStorageBlob

Get-AzureStorageBlobContent