< Back
Set-AzureStorageBlobContent
Post
NAME Set-AzureStorageBlobContent
SYNOPSIS
Uploads a local file to an Azure Storage blob.
SYNTAX
Set-AzureStorageBlobContent [-File] <String> [-Container] <String> [-Blob <String>] [-BlobType {Block | Page | Append}] [-ClientTimeoutPerRequest
<Int32>] [-ConcurrentTaskCount <Int32>] [-Context <IStorageContext>] [-Force] [-Metadata <Hashtable>] [-PremiumPageBlobTier <PremiumPageBlobTier>]
[-Properties <Hashtable>] [-ServerTimeoutPerRequest <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]
Set-AzureStorageBlobContent [-File] <String> [-Blob <String>] [-BlobType {Block | Page | Append}] [-ClientTimeoutPerRequest <Int32>]
-CloudBlobContainer <CloudBlobContainer> [-ConcurrentTaskCount <Int32>] [-Context <IStorageContext>] [-Force] [-Metadata <Hashtable>]
[-PremiumPageBlobTier <PremiumPageBlobTier>] [-Properties <Hashtable>] [-ServerTimeoutPerRequest <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]
Set-AzureStorageBlobContent [-File] <String> [-BlobType {Block | Page | Append}] [-ClientTimeoutPerRequest <Int32>] -CloudBlob <CloudBlob>
[-ConcurrentTaskCount <Int32>] [-Context <IStorageContext>] [-Force] [-Metadata <Hashtable>] [-PremiumPageBlobTier <PremiumPageBlobTier>]
[-Properties <Hashtable>] [-ServerTimeoutPerRequest <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]
DESCRIPTION
The Set-AzureStorageBlobContent cmdlet uploads a local file to an Azure Storage blob.
PARAMETERS
-Blob <String>
Specifies the name of a blob. This cmdlet uploads a file to the Azure Storage blob that this parameter specifies.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-BlobType <String>
Specifies the type for the blob that this cmdlet uploads. The acceptable values for this parameter are:
- Block
- Page
The default value is Block.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-ClientTimeoutPerRequest <Int32>
Specifies the client-side time-out interval, in seconds, for one service request. If the previous call fails in the specified interval, this
cmdlet retries the request. If this cmdlet does not receive a successful response before the interval elapses, this cmdlet returns an error.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-CloudBlob <CloudBlob>
Specifies a CloudBlob object. To obtain a CloudBlob object, use the Get-AzureStorageBlob cmdlet.
Required? true
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-CloudBlobContainer <CloudBlobContainer>
Specifies a CloudBlobContainer object from the Azure Storage Client library. This cmdlet uploads content to a blob in the container that this
parameter specifies. To obtain a CloudBlobContainer object, use the Get-AzureStorageContainer cmdlet.
Required? true
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-ConcurrentTaskCount <Int32>
Specifies the maximum concurrent network calls. 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. This parameter can help reduce network connection problems in low bandwidth environments, such as 100 kilobits per second. The default
value is 10.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Container <String>
Specifies the name of a container. This cmdlet uploads a file to a blob in the container that this parameter specifies.
Required? true
Position? 1
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Context <IStorageContext>
Specifies an Azure storage context. To obtain a storage context, use the New-AzureStorageContext cmdlet.
Required? false
Position? named
Default value None
Accept pipeline input? True (ByPropertyName, ByValue)
Accept wildcard characters? false
-File <String>
Specifies a local file path for a file to upload as blob content.
Required? true
Position? 0
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Force [<SwitchParameter>]
Indicates that this cmdlet overwrites an existing blob without prompting you for confirmation.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Metadata <Hashtable>
Specifies metadata for the uploaded blob.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-PremiumPageBlobTier <PremiumPageBlobTier>
Page Blob Tier
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Properties <Hashtable>
Specifies properties for the uploaded blob. The supported properties are: CacheControl, ContentDisposition, ContentEncoding, ContentLanguage,
ContentMD5, ContentType.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-ServerTimeoutPerRequest <Int32>
Specifies the service side time-out interval, in seconds, for a request. If the specified interval elapses before the service processes the
request, the storage service returns an error.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
Prompts you for confirmation before running the cmdlet.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
IStorageContext
Parameter 'Context' accepts value of type 'IStorageContext' from the pipeline
OUTPUTS
Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageBlob
NOTES
Example 1: Upload a named file
PS C:\\>Set-AzureStorageBlobContent -Container "ContosoUpload" -File ".\\PlanningData" -Blob "Planning2015"
This command uploads the file that is named PlanningData to a blob named Planning2015.
Example 2: Upload all files under the current folder
PS C:\\>Get-ChildItem -File -Recurse | Set-AzureStorageBlobContent -Container "ContosoUploads"
This command uses the core Windows PowerShell cmdlet Get-ChildItem to get all the files in the current folder and in subfolders, and then passes
them to the current cmdlet by using the pipeline operator. The Set-AzureStorageBlobContent cmdlet uploads the files to the container named
ContosoUploads.
Example 3: Overwrite an existing blob
PS C:\\>Get-AzureStorageBlob -Container "ContosoUploads" -Blob "Planning2015" | Set-AzureStorageBlobContent -File "ContosoPlanning"
This command gets the blob named Planning2015 in the ContosoUploads container by using the Get-AzureStorageBlob cmdlet, and then passes that blob
to the current cmdlet. The command uploads the file that is named ContosoPlanning as Planning2015. This command does not specify the Force
parameter. The command prompts you for confirmation. If you confirm the command, the cmdlet overwrites the existing blob.
Example 4: Upload a file to a container by using the pipeline
PS C:\\>Get-AzureStorageContainer -Container "ContosoUpload*" | Set-AzureStorageBlobContent -File "ContosoPlanning" -Blob "Planning2015"
This command gets the container that starts with the string ContosoUpload by using the Get-AzureStorageContainer cmdlet, and then passes that blob
to the current cmdlet. The command uploads the file that is named ContosoPlanning as Planning2015.
Example 5: Upload a file to page blob with metadata and PremiumPageBlobTier as P10
PS C:\\>$Metadata = @{"key" = "value"; "name" = "test"}
PS C:\\> Set-AzureStorageBlobContent -File "ContosoPlanning" -Container "ContosoUploads" -Metadata $Metadata -BlobType Page -PremiumPageBlobTier P10
The first command creates a hash table that contains metadata for a blob, and stores that hash table in the $Metadata variable.
The second command uploads the file that is named ContosoPlanning to the container named ContosoUploads. The blob includes the metadata stored in
$Metadata, and has PremiumPageBlobTier as P10.
Example 6: Upload a file to blob with specified blob properties
PS C:\\> Set-AzureStorageBlobContent -File "ContosoPlanning" -Container "ContosoUploads" -Properties @{"ContentType" = "image/jpeg"; "ContentMD5" =
"i727sP7HigloQDsqadNLHw=="}
This command uploads the file that is named ContosoPlanning to the container named ContosoUploads with specified blob properties.
RELATED LINKS
Online Version: https://docs.microsoft.com/en-us/powers ... lobcontent
Get-AzureStorageBlobContent
Get-AzureStorageBlob
Remove-AzureStorageBlob
SYNOPSIS
Uploads a local file to an Azure Storage blob.
SYNTAX
Set-AzureStorageBlobContent [-File] <String> [-Container] <String> [-Blob <String>] [-BlobType {Block | Page | Append}] [-ClientTimeoutPerRequest
<Int32>] [-ConcurrentTaskCount <Int32>] [-Context <IStorageContext>] [-Force] [-Metadata <Hashtable>] [-PremiumPageBlobTier <PremiumPageBlobTier>]
[-Properties <Hashtable>] [-ServerTimeoutPerRequest <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]
Set-AzureStorageBlobContent [-File] <String> [-Blob <String>] [-BlobType {Block | Page | Append}] [-ClientTimeoutPerRequest <Int32>]
-CloudBlobContainer <CloudBlobContainer> [-ConcurrentTaskCount <Int32>] [-Context <IStorageContext>] [-Force] [-Metadata <Hashtable>]
[-PremiumPageBlobTier <PremiumPageBlobTier>] [-Properties <Hashtable>] [-ServerTimeoutPerRequest <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]
Set-AzureStorageBlobContent [-File] <String> [-BlobType {Block | Page | Append}] [-ClientTimeoutPerRequest <Int32>] -CloudBlob <CloudBlob>
[-ConcurrentTaskCount <Int32>] [-Context <IStorageContext>] [-Force] [-Metadata <Hashtable>] [-PremiumPageBlobTier <PremiumPageBlobTier>]
[-Properties <Hashtable>] [-ServerTimeoutPerRequest <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]
DESCRIPTION
The Set-AzureStorageBlobContent cmdlet uploads a local file to an Azure Storage blob.
PARAMETERS
-Blob <String>
Specifies the name of a blob. This cmdlet uploads a file to the Azure Storage blob that this parameter specifies.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-BlobType <String>
Specifies the type for the blob that this cmdlet uploads. The acceptable values for this parameter are:
- Block
- Page
The default value is Block.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-ClientTimeoutPerRequest <Int32>
Specifies the client-side time-out interval, in seconds, for one service request. If the previous call fails in the specified interval, this
cmdlet retries the request. If this cmdlet does not receive a successful response before the interval elapses, this cmdlet returns an error.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-CloudBlob <CloudBlob>
Specifies a CloudBlob object. To obtain a CloudBlob object, use the Get-AzureStorageBlob cmdlet.
Required? true
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-CloudBlobContainer <CloudBlobContainer>
Specifies a CloudBlobContainer object from the Azure Storage Client library. This cmdlet uploads content to a blob in the container that this
parameter specifies. To obtain a CloudBlobContainer object, use the Get-AzureStorageContainer cmdlet.
Required? true
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-ConcurrentTaskCount <Int32>
Specifies the maximum concurrent network calls. 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. This parameter can help reduce network connection problems in low bandwidth environments, such as 100 kilobits per second. The default
value is 10.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Container <String>
Specifies the name of a container. This cmdlet uploads a file to a blob in the container that this parameter specifies.
Required? true
Position? 1
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Context <IStorageContext>
Specifies an Azure storage context. To obtain a storage context, use the New-AzureStorageContext cmdlet.
Required? false
Position? named
Default value None
Accept pipeline input? True (ByPropertyName, ByValue)
Accept wildcard characters? false
-File <String>
Specifies a local file path for a file to upload as blob content.
Required? true
Position? 0
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Force [<SwitchParameter>]
Indicates that this cmdlet overwrites an existing blob without prompting you for confirmation.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Metadata <Hashtable>
Specifies metadata for the uploaded blob.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-PremiumPageBlobTier <PremiumPageBlobTier>
Page Blob Tier
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Properties <Hashtable>
Specifies properties for the uploaded blob. The supported properties are: CacheControl, ContentDisposition, ContentEncoding, ContentLanguage,
ContentMD5, ContentType.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-ServerTimeoutPerRequest <Int32>
Specifies the service side time-out interval, in seconds, for a request. If the specified interval elapses before the service processes the
request, the storage service returns an error.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
Prompts you for confirmation before running the cmdlet.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
IStorageContext
Parameter 'Context' accepts value of type 'IStorageContext' from the pipeline
OUTPUTS
Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageBlob
NOTES
Example 1: Upload a named file
PS C:\\>Set-AzureStorageBlobContent -Container "ContosoUpload" -File ".\\PlanningData" -Blob "Planning2015"
This command uploads the file that is named PlanningData to a blob named Planning2015.
Example 2: Upload all files under the current folder
PS C:\\>Get-ChildItem -File -Recurse | Set-AzureStorageBlobContent -Container "ContosoUploads"
This command uses the core Windows PowerShell cmdlet Get-ChildItem to get all the files in the current folder and in subfolders, and then passes
them to the current cmdlet by using the pipeline operator. The Set-AzureStorageBlobContent cmdlet uploads the files to the container named
ContosoUploads.
Example 3: Overwrite an existing blob
PS C:\\>Get-AzureStorageBlob -Container "ContosoUploads" -Blob "Planning2015" | Set-AzureStorageBlobContent -File "ContosoPlanning"
This command gets the blob named Planning2015 in the ContosoUploads container by using the Get-AzureStorageBlob cmdlet, and then passes that blob
to the current cmdlet. The command uploads the file that is named ContosoPlanning as Planning2015. This command does not specify the Force
parameter. The command prompts you for confirmation. If you confirm the command, the cmdlet overwrites the existing blob.
Example 4: Upload a file to a container by using the pipeline
PS C:\\>Get-AzureStorageContainer -Container "ContosoUpload*" | Set-AzureStorageBlobContent -File "ContosoPlanning" -Blob "Planning2015"
This command gets the container that starts with the string ContosoUpload by using the Get-AzureStorageContainer cmdlet, and then passes that blob
to the current cmdlet. The command uploads the file that is named ContosoPlanning as Planning2015.
Example 5: Upload a file to page blob with metadata and PremiumPageBlobTier as P10
PS C:\\>$Metadata = @{"key" = "value"; "name" = "test"}
PS C:\\> Set-AzureStorageBlobContent -File "ContosoPlanning" -Container "ContosoUploads" -Metadata $Metadata -BlobType Page -PremiumPageBlobTier P10
The first command creates a hash table that contains metadata for a blob, and stores that hash table in the $Metadata variable.
The second command uploads the file that is named ContosoPlanning to the container named ContosoUploads. The blob includes the metadata stored in
$Metadata, and has PremiumPageBlobTier as P10.
Example 6: Upload a file to blob with specified blob properties
PS C:\\> Set-AzureStorageBlobContent -File "ContosoPlanning" -Container "ContosoUploads" -Properties @{"ContentType" = "image/jpeg"; "ContentMD5" =
"i727sP7HigloQDsqadNLHw=="}
This command uploads the file that is named ContosoPlanning to the container named ContosoUploads with specified blob properties.
RELATED LINKS
Online Version: https://docs.microsoft.com/en-us/powers ... lobcontent
Get-AzureStorageBlobContent
Get-AzureStorageBlob
Remove-AzureStorageBlob