I am writing a PowerShell script to communicate with my Microsoft Azure account, and I am facing an issue with uploading and downloading files using the Set-AzureStorageBlobContent and Get-AzureStorageBlobContent modules.
$Upload = @{
Context = $storageContext;
Container = $container;
File = "C:\... \file.csv";
}
Set-AzureStorageBlobContent @Upload -Force;
The first time I run this, it appears to start uploading, but it stays at 0% and never rises. If I cancel it and try executing my script again, I get an error that says: "Set-AzureStorageBlobContent : A transfer operation with the same source and destination already exists." A nearly identical thing happens when I try to download an existing blob from Azure.
$params = @{
Context = $storageContext;
Container = $container;
Blob = $blob;
Destination = $dest
}
New-Item -Path $dest -ItemType Directory -Force
Get-AzureStorageBlobContent @params
I have tried reinstalling Azure.Storage, which is the module that contains the cmdlet Get-AzureStorageBlobContent and Set-AzureStorageBlobContent, but I had no luck. Am I doing something incorrectly, or is this code just wrong somehow?
It seems to be something with your $Upload variable. Try this instead:
Get-ChildItem –Path C:\Images\* | Set-AzureStorageBlobContent -Container "yourcontainername"
more info: https://docs.microsoft.com/en-us/azure/storage/storage-powershell-guide-full
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.