Azure Automation Power Shell- 如何将 Zip 文件夹从 URL 和 post 下载到 Azure blob

Azure Automation Power Shell- How to download Zip folder from URL and post to Azure blob

我正在尝试从 url (https://data.police.uk/data/archive/2019-10.zip) 下载 zip 数据并将其放入存储帐户 (blob)。

PS 需要 运行 在 Azure 自动化帐户中。

使用下面的代码时,出现异常

There is not enough space on the disk

$url = "https://data.police.uk/data/archive/2019-10.zip"
$output = "\policedata.zip"

$wc = New-Object System.Net.WebClient
$download = $wc.DownloadFile($url, $output)

有没有办法将 zip 文件移动到 Azure 存储 blob,首先在本地下载它,或者从中提取 CSV?

鉴于您正在下载的文件是 1.6 GB,Azure 自动化不是这里的正确解决方案。问题是 limits Azure Automation 有:

Maximum amount of disk space allowed per sandbox: 1 GB

Maximum amount of memory given to a sandbox: 400 MB

您既不能在上传前下载文件,也不能将其保存在内存中然后通过管道传输到存储帐户。

您可以尝试设置双向流,其中一个流下载文件,另一个流上传文件。但这对于您要尝试做的事情来说太过分了。我建议使用 vanilla 容器或 VM 来自动执行此操作。