Uploads a local file to an Azure Storage blob.
Syntax SendManual (Default)Set-AzStorageBlobContent
[-File] <String>
[-Container] <String>
[-Blob <String>]
[-BlobType <String>]
[-Properties <Hashtable>]
[-Metadata <Hashtable>]
[-Tag <Hashtable>]
[-PremiumPageBlobTier <PremiumPageBlobTier>]
[-StandardBlobTier <String>]
[-EncryptionScope <String>]
[-Force]
[-AsJob]
[-TagCondition <String>]
[-Context <IStorageContext>]
[-ServerTimeoutPerRequest <Int32>]
[-ClientTimeoutPerRequest <Int32>]
[-DefaultProfile <IAzureContextContainer>]
[-ConcurrentTaskCount <Int32>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ContainerPipeline
Set-AzStorageBlobContent
[-File] <String>
-CloudBlobContainer <CloudBlobContainer>
[-Blob <String>]
[-BlobType <String>]
[-Properties <Hashtable>]
[-Metadata <Hashtable>]
[-Tag <Hashtable>]
[-PremiumPageBlobTier <PremiumPageBlobTier>]
[-StandardBlobTier <String>]
[-EncryptionScope <String>]
[-Force]
[-AsJob]
[-TagCondition <String>]
[-Context <IStorageContext>]
[-ServerTimeoutPerRequest <Int32>]
[-ClientTimeoutPerRequest <Int32>]
[-DefaultProfile <IAzureContextContainer>]
[-ConcurrentTaskCount <Int32>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
BlobPipeline
Set-AzStorageBlobContent
[-File] <String>
-CloudBlob <CloudBlob>
[-BlobType <String>]
[-Properties <Hashtable>]
[-Metadata <Hashtable>]
[-Tag <Hashtable>]
[-PremiumPageBlobTier <PremiumPageBlobTier>]
[-StandardBlobTier <String>]
[-EncryptionScope <String>]
[-Force]
[-AsJob]
[-TagCondition <String>]
[-Context <IStorageContext>]
[-ServerTimeoutPerRequest <Int32>]
[-ClientTimeoutPerRequest <Int32>]
[-DefaultProfile <IAzureContextContainer>]
[-ConcurrentTaskCount <Int32>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Set-AzStorageBlobContent cmdlet uploads a local file to an Azure Storage blob.
Examples Example 1: Upload a named fileSet-AzStorageBlobContent -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 folderGet-ChildItem -File -Recurse | Set-AzStorageBlobContent -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-AzStorageBlobContent cmdlet uploads the files to the container named ContosoUploads.
Example 3: Overwrite an existing blobGet-AzStorageBlob -Container "ContosoUploads" -Blob "Planning2015" | Set-AzStorageBlobContent -File "ContosoPlanning"
This command gets the blob named Planning2015 in the ContosoUploads container by using the Get-AzStorageBlob 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 pipelineGet-AzStorageContainer -Container "ContosoUpload*" | Set-AzStorageBlobContent -File "ContosoPlanning" -Blob "Planning2015"
This command gets the container that starts with the string ContosoUpload by using the Get-AzStorageContainer 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$Metadata = @{"key" = "value"; "name" = "test"}
Set-AzStorageBlobContent -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, and set StandardBlobTier as Cool$filepath = "c:\temp\index.html"
Set-AzStorageBlobContent -File $filepath -Container "contosouploads" -Properties @{"ContentType" = [System.Web.MimeMapping]::GetMimeMapping($filepath); "ContentMD5" = "i727sP7HigloQDsqadNLHw=="} -StandardBlobTier Cool
AccountName: storageaccountname, ContainerName: contosouploads
Name BlobType Length ContentType LastModified AccessTier SnapshotTime IsDeleted VersionId
---- -------- ------ ----------- ------------ ---------- ------------ --------- ---------
index.html BlockBlob 403116 text/html 2020-09-22 08:06:53Z Cool False
This command uploads the file c:\temp\index.html to the container named contosouploads with specified blob properties, and set StandardBlobTier as Cool. This command gets ContentType value set to blob properties by [System.Web.MimeMapping]::GetMimeMapping() API.
Example 7: Upload a file to a blob with Encryption Scope$blob = Set-AzStorageBlobContent -File "mylocalfile" -Container "mycontainer" -Blob "myblob" -EncryptionScope "myencryptscope"
$blob.BlobProperties.EncryptionScope
myencryptscope
This command uploads a file to a blob with Encryption Scope.
Parameters -AsJobRun cmdlet in the background.
Parameter properties Type: SwitchParameter Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -BlobSpecifies the name of a blob. This cmdlet uploads a file to the Azure Storage blob that this parameter specifies.
Parameter properties Type: String Default value: None Supports wildcards: False DontShow: False Parameter sets SendManual Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False ContainerPipeline Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -BlobTypeSpecifies the type for the blob that this cmdlet uploads. The acceptable values for this parameter are:
The default value is Block.
Parameter properties Type: String Default value: None Accepted values: Block, Page, Append Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -ClientTimeoutPerRequestSpecifies 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.
Parameter properties Type: Default value: None Supports wildcards: False DontShow: False Aliases: ClientTimeoutPerRequestInSeconds Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -CloudBlobSpecifies a CloudBlob object. To obtain a CloudBlob object, use the Get-AzStorageBlob cmdlet.
Parameter properties Type: Microsoft.Azure.Storage.Blob.CloudBlob Default value: None Supports wildcards: False DontShow: False Aliases: ICloudBlob Parameter sets BlobPipeline Position: Named Mandatory: True Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False -CloudBlobContainerSpecifies 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-AzStorageContainer cmdlet.
Parameter properties Type: Microsoft.Azure.Storage.Blob.CloudBlobContainer Default value: None Supports wildcards: False DontShow: False Parameter sets ContainerPipeline Position: Named Mandatory: True Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False -ConcurrentTaskCountSpecifies 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.
Parameter properties Type: Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -ConfirmPrompts you for confirmation before running the cmdlet.
Parameter properties Type: SwitchParameter Default value: False Supports wildcards: False DontShow: False Aliases: cf Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -ContainerSpecifies the name of a container. This cmdlet uploads a file to a blob in the container that this parameter specifies.
Parameter properties Type: String Default value: None Supports wildcards: False DontShow: False Parameter sets SendManual Position: 1 Mandatory: True Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -ContextSpecifies an Azure storage context. To obtain a storage context, use the New-AzStorageContext cmdlet. To use a storage context created from a SAS Token without read permission, need add -Force parameter to skip check blob existence.
Parameter properties Type: IStorageContext Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: True Value from pipeline by property name: True Value from remaining arguments: False -DefaultProfileThe credentials, account, tenant, and subscription used for communication with Azure.
Parameter properties Type: IAzureContextContainer Default value: None Supports wildcards: False DontShow: False Aliases: AzureRmContext, AzureCredential Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -EncryptionScopeEncryption scope to be used when making requests to the blob.
Parameter properties Type: String Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -FileSpecifies a local file path for a file to upload as blob content.
Parameter properties Type: String Default value: None Supports wildcards: False DontShow: False Aliases: FullName Parameter sets SendManual Position: 0 Mandatory: True Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False -ForceIndicates that this cmdlet overwrites an existing blob without prompting you for confirmation.
Parameter properties Type: SwitchParameter Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -MetadataSpecifies metadata for the uploaded blob.
Parameter properties Type: Hashtable Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -PremiumPageBlobTierPage Blob Tier
Parameter properties Type: Microsoft.Azure.Storage.Blob.PremiumPageBlobTier Default value: None Accepted values: Unknown, P4, P6, P10, P20, P30, P40, P50, P60, P70, P80 Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -PropertiesSpecifies properties for the uploaded blob. The supported properties are: CacheControl, ContentDisposition, ContentEncoding, ContentLanguage, ContentMD5, ContentType.
Parameter properties Type: Hashtable Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -ServerTimeoutPerRequestSpecifies 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.
Parameter properties Type: Default value: None Supports wildcards: False DontShow: False Aliases: ServerTimeoutPerRequestInSeconds Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -StandardBlobTierBlock Blob Tier, valid values are Hot/Cool/Archive/Cold. See detail in https://learn.microsoft.com/azure/storage/blobs/storage-blob-storage-tiers
Parameter properties Type: String Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -TagBlob Tags
Parameter properties Type: Hashtable Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -TagConditionOptional Tag expression statement to check match condition. The blob request will fail when the blob tags does not match the given expression. See details in https://learn.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations#tags-conditional-operations.
Parameter properties Type: String Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -WhatIfShows what would happen if the cmdlet runs. The cmdlet is not run.
Parameter properties Type: SwitchParameter Default value: False Supports wildcards: False DontShow: False Aliases: wi Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False CommonParametersThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs String Microsoft.Azure.Storage.Blob.CloudBlobContainer Microsoft.Azure.Storage.Blob.CloudBlob IStorageContext Outputs AzureStorageBlobRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4