【问题标题】:Copy files from azure blob storage to local storage in pipeline将文件从 azure blob 存储复制到管道中的本地存储
【发布时间】:2022-09-28 03:02:11
【问题描述】:
我正在尝试将 test.xml 从 azure blob 存储复制到 azure devops 管道中本地计算机中的 c:\\data\\test.xml。我想将此作为管道任务执行,因此我假设运行一个传递了 PAT 令牌的 powershell 脚本。根据不同的文章,我可以使用azcopy。但我想避免这种安装,可以简单地复制文件。
-
如果要使用 AZCOPY,则需要安装。考虑使用 rest api。例如。 Get Blob
标签:
azure
azure-devops
azure-pipelines
azure-blob-storage
【解决方案1】:
我可以使用 azure cli 任务来解决这个问题。
- task: AzureCLI@2
displayName: 'Download Keys From Blob'
inputs:
azureSubscription: 'xxxxxx'
scriptType: 'ps'
scriptLocation: 'inlineScript'
inlineScript: 'az storage blob download --file "test.xml" --name "test.xml" --container keys --connection-string "$(ConnectionStringInetpubKeys)"'
workingDirectory: 'C:\inetpub\keys'