1

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

1 Answer 1

2

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 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.