且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从Azure管道内的Blob存储中下载文件?

更新时间:2023-02-14 22:16:54

您可以尝试执行

You can try to execute az storage blob download command in Azure cli task to download files from Azure Blob Storage:

steps:
- task: AzureCLI@1
  displayName: 'Azure CLI '
  inputs:
    azureSubscription: {service connection}
    scriptLocation: inlineScript
    inlineScript: |
     mkdir $(Build.SourcesDirectory)\BlobFile
     az storage blob download --container-name $(containername) --file $(Build.SourcesDirectory)\BlobFile --name "{file name}" --account-key $(accountkey) --account-name $(accountname)

使用 mkdir 在当前目录中创建一个文件夹,然后从blob下载文件并将其保存到该文件夹​​中.服务连接已集成到此任务中,因此您可以配置服务连接以连接到Azure blob.然后在此Azure cli任务中选择它.

Using mkdir to create a folder in current directory, then download file from blob and save it into this folder. Service connection is integrated into this task, so you can configure the service connection to connect to your Azure blob. Then select it in this Azure cli task.