使用 powershell 从 Adls gen1 下载文件不起作用

Downloading a file from Adls gen1 using powershell is not working

我正在尝试使用 powershell 脚本从 azure data lake store 下载文件。该代码是从 Azure 云中的运行手册触发的。看起来 Export-AdlStoreItem 没有工作,因为 expected.I 没有收到任何错误消息或编译错误。事实上,当执行此命令时,会在 destination.The 中生成一个零字节文件,该文件的名称是 TemporaryFile2020-06-02_14-56-57.datc18371c2-d39c-4588-9af0-93aa3e136b01Segments 发生了什么事?请帮忙!

$LocalDwldPath = "T:\ICE_PROD_DATA_SOURCING\FILE_DOWNLOAD_PATH\TemporaryFile$($TimeinSec).dat"
    $SourcePath = "Dataproviders/Landing/GCW/HPIndirect/Orders/AMS/gcw_hp_indirect_orders_ams_745_20200601_04_34_01.dat"
    $PRODAdlsName = "itgdls01"
    Export-AdlStoreItem  -Account $PRODAdlsName -Path  $("/" + $SourcePath.Trim()) -Destination $LocalDwldPath -Force -ErrorAction Stop
    if( Test-Path $LocalDwldPath.Trim() )
    {
    Get-Content -Path $LocalDwldPath.Trim() -ReadCount 1000 |% { $FileCount += $_.Count }   
        Remove-Item $LocalDwldPath.Trim()
        Set-Content -Path $cntCaptureFile -Value $FileCount
        $TimeinSec = TimeStamp2
        Add-Content -Value "$TimeinSec Log: Identified file for getting count is $($SourcePath.Trim()) and the count is $FileCount" -Path $logfile  
    }
    else
    {                       
        $TimeinSec = TimeStamp2     
        Add-Content -Value "$TimeinSec Error: Identified file for getting count is $($SourcePath.Trim()) and the count capture failed as local file is not found!" -Path $logfile
    }   

根据我的研究,如果你想用 PowerShell 从 Azure Data Lake 下载文件,我们可以使用 PowerShell 命令 Export-AzDataLakeStoreItem.

例如

Export-AzDataLakeStoreItem -Account <> -Path '/test/test.csv' -Destination 'D:\myDirectory\test.csv'

详情请参考document

本地下载有问题path/destination ("T:\ICE_PROD_DATA_SOURCING\FILE_DOWNLOAD_PATH\TemporaryFile$($TimeinSec).dat")。 T:\ 驱动器是作为 Azure 文件共享连接的虚拟 drive/network 驱动器。

而不是 T:\ ,我将目标位置指向本地驱动器 ("F:\ICE_PROD_DATA_SOURCING\FILE_DOWNLOAD_PATH\TemporaryFile$($TimeinSec).dat"),它工作正常。

令人惊讶的是,当 Powershell 无法将文件保存在指向 azure 文件共享的网络路径中时,它没有给出任何错误消息。