2
votes

In my Build pipeline, I used the 'AzureBlob File Copy' task where I upload my app's Web Deploy Zip file onto Azure Blob Storage.

I would like to know in Release management, if it is possible, how can I download the Zip file from Azure Blob Storage and use as artifact in my Release pipeline?

is this common practice? because I would like to store different build versions of my app.

2

2 Answers

1
votes

The best practice is usually to use the task copy and upload artifact so the artifact is attached to the build itself.
This way you'd be able to use it in your release definition to deploy it somewhere.
Now if you want to have some kind of archiving in azure you can do both things, if you need to have an url to the artifact (for example if you're deploying an ARM template) then uploading to azure is the best practice.
Technically the part where you upload to azure should be done in the release process because it's more meant for that than build.
So to recap the flow is build => artifact => release => upload and deploy to azure.
I hope that helps.

-1
votes

You can add an "Azure PowerShell" task in your build definition to get the files from Azure Blob:

enter image description here

Here is a basic Azure PowerShell script to get the files from Blob you can use in Release:

$SubscriptionName = "Subscription Name"

$StorageAccountName = "Storage Account Name"

$Location = "Storage Location"

$ContainerName = "ContainerName"

$DestinationFolder = $env:System_DefaultWorkingDirectory

Set-AzureSubscription -CurrentStorageAccountName $StorageAccountName -SubscriptionName $SubscriptionName

Get-AzureStorageBlob -Container $ContainerName

$blobs = Get-AzureStorageBlob -Container $ContainerName

New-Item -Path $DestinationFolder -ItemType Directory -Force  

$blobs | Get-AzureStorageBlobContent –Destination $DestinationFolder -Force