Reputation: 19
I'm needing to upload files to a folder within a blob container (BlobContainer\Files\
where BlobContainer
is the container name and Files
is the folder within the container), but when I pass that into the -Container
parameter, it fails because it can't find that blob container. Is there a way to specify a specific folder within a blob container when uploading a file using the Set-AzureStorageBlobContent
or if not, an alternate route to do this?
The below is the snippet of what I'm calling after logging in:
$storageacct = New-AzureStorageContext -ConnectionString "CONNECTIONSTRING"
Set-AzureStorageBlobContent -File "E:\Files\file.txt" -Container "BlobContainer" -Context $storageacct
Upvotes: 1
Views: 1628
Reputation: 18387
In Azure Storage, you don't have folders. Inside a container, you upload blobs. You can add a "prefix" to the blob name giving this idea of folders as the following:
$containerName = "blobcontainer"
New-AzStorageContainer -Name $containerName -Context $ctx -Permission blob
# upload a file
Set-AzStorageBlobContent -File "D:\_TestImages\Image001.jpg" `
-Container $containerName `
-Blob "Foldername/Image003.jpg" `
-Context $ctx
Upvotes: 2