-1

I'm attempting to create a pipeline in Azure DevOps to both build and deploy a static web page. I've managed to build and publish the artifacts using the following pipeline configuration:

- task: PublishBuildArtifacts@1
  displayName: Publish Build Artifacts
  inputs:
    PathtoPublish: './app/public'
    ArtifactName: 'website'
    publishLocation: 'Container'
    
- task: AzureKeyVault@2
  inputs:
    azureSubscription: ${{ variables.AZURE_SUBSCRIPTION }}
    KeyVaultName: 'xx-keyvault'
    SecretsFilter: 'XX-XX-XX'
    
- script: |
    # Set the secret value as an environment variable
    export AZURE_STORAGE_CONNECTION_STRING=$(XX-XX-XX)

- task: DownloadBuildArtifacts@0
  displayName: 'Download Build Artifacts'
  inputs:
    buildType: 'current'
    downloadType: 'single'
    artifactName: 'website'
    downloadPath: $(Pipeline.Workspace)/artifacts
    
- script: |
    az storage blob upload-batch --destination XXX --source $(Pipeline.Workspace)/artifacts
  displayName: 'Upload to Azure Storage'
  env:
    AZURE_STORAGE_CONNECTION_STRING: $(AZURE_STORAGE_CONNECTION_STRING)

However, after publishing the build artifacts, I'm not entirely sure how to proceed with the deployment process. I've already implemented a similar flow using an Azure DevOps release pipeline, but now I want to achieve the same result within the same pipeline. Any suggestions or guidance on how to continue from this point would be greatly appreciated.

The primary goal is to deploy the static web to azure storage account without relying on the Azure DevOps release pipeline. Thank you in advance for your assistance!

stela
  • 27
  • 4

1 Answers1

0

Instead of the AZ CLI script, use a AzureFileCopy@4 task

e.g

- task: AzureFileCopy@4
  inputs:
    SourcePath: $(Pipeline.Workspace)/artifacts/*
    azureSubscription: ${{ variables.AZURE_SUBSCRIPTION }}
    Destination: 'AzureBlob'
    storage: myFileStorage
    ContainerName: 'myContainer001'

https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/azure-file-copy-v4?view=azure-pipelines

Seb
  • 1