Azure Pipeline/AZ Copy not copying to root directory in storage blob
Asked Answered
T

2

6

I'm having issues with deploying my github code to azure storage via azure pipeline. It deploys via AZCopy, but it's going into a subdirectory, which I believe is the reason I'm getting a 404 since the index.html file isn't in the root directory. How can I get my pipeline to deploy storage blob for the root directory?

enter image description here

steps:
- task: AzureFileCopy@2
  displayName: 'AzureBlob File Copy'
  inputs:
    SourcePath: dist/
    azureSubscription: '<subscription was here>'
    Destination: AzureBlob
    storage: ivflowstorageaccount
    ContainerName: '$web'

The folder it copies to $web has my dist files in it so the previous steps seem fine, but I just don't know why it's not copying to root directory. I appreciate any help!

enter image description here

Thrum answered 30/7, 2020 at 16:19 Comment(0)
W
7

I had the same problem. You need to replace SourcePath: dist/ with SourcePath: dist/*. Then the content of the subfolder will be copied to the root of $web instead of the subfolder itself.

Welsh answered 18/9, 2021 at 14:22 Comment(1)
With AzureFileCopy@5 it would be dist/**Dibru
D
1

Usually, without specifying Blob Prefix, the content in the specified folder is copied to the root of the container by default.

According to the screenshot, It seems like the directory structure is as follows.

dist 

-ivflow 
 
  -index.html

The file index.html is in the folder ivflow, and you want to copy the index.html to root directory in storage blob, we can delete the index.html file and recopy the file to root directory via the task Azure file copy(SourcePath: dist/ivflow/ivflow).

If you want to remove all directory structure and only copy file to storage blob, we recommend that you copy the folder one by one from the bottom folder.

In addition, please try to use AzureFileCopy@3 instead of AzureFileCopy@2.

Detestation answered 31/7, 2020 at 9:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.