Azure 无法以编程方式下载Blob
我们在azure存储容器中有多个Blob,当我们使用powershell下载Blob(文件)时,下载的9个文件中有8个,但第9个失败。这个文件完全没有什么不同,我在blob属性中注意到的唯一一点是“contentmd5”为空,而其他8个有一个值。我不知道这是什么,也不知道是否与此有关,我希望有人能解释一下为什么这是一个没有下载的文件Azure 无法以编程方式下载Blob,azure,powershell,Azure,Powershell,我们在azure存储容器中有多个Blob,当我们使用powershell下载Blob(文件)时,下载的9个文件中有8个,但第9个失败。这个文件完全没有什么不同,我在blob属性中注意到的唯一一点是“contentmd5”为空,而其他8个有一个值。我不知道这是什么,也不知道是否与此有关,我希望有人能解释一下为什么这是一个没有下载的文件 提前感谢:)请尝试下面的代码从Azure Blob下载文件 function Get-DLLFile { param( [Parameter(
提前感谢:)请尝试下面的代码从Azure Blob下载文件
function Get-DLLFile
{
param(
[Parameter(Mandatory=$true)] [string] $connectionString,
[Parameter(Mandatory=$true)] [String[]] $blobsName,
[Parameter(Mandatory=$true)] [string] $container,
[Parameter(Mandatory=$true)] [string] $filePath
)
Try
{
foreach ($blobName in $blobsName)
{
$file = $filePath + $blobName
$fileAvailable = Get-Item -Path $file -ErrorAction SilentlyContinue
if($null -eq $fileAvailable)
{
$ctx = New-AzureStorageContext -ConnectionString $connectionString
New-Item -Path $filePath -ItemType Directory -Force | Out-Null
Get-AzureStorageBlobContent -Blob $blobName -Container $container -Destination $filePath -Context $ctx -Force | out-null
}
}
}
Catch
{
$_.Exception.Message
}
}
Get-DLLFile -blobsName "File1.csv","File2.json" -container "myContainer" -connectionString "$(BlobConnectionString)" -filePath "$(System.DefaultWorkingDirectory)/Download"
希望这能起作用,如果没有,请分享您遇到的异常。您使用的是Azure Storage PowerShell cmdlet还是您自己编写的?请共享您的代码。只需使用powershell使用存储下载文件context@NorrinRad你能分享一下密码吗?另外,如果在运行脚本时出现任何错误消息