Deploy files to azure

We have an installer package (MSI) containing an application which we want to deploy with Octopus. The MSI file needs to be uploaded to Azure Blob storage so clients can download the new version. The problem is that we cannot really find a suitable build step for this. We have investigated the following options:

  • There is the ‘Run Azure Powershell’ step but it is not related to a package so we cannot access the content.
  • The ‘Deploy Cloud Service’ step is all about deploying a service. We need to enter the storage account, cloud service name, swap deployment, etc. We can misuse this step and run a custom DeployToAzure.ps1 script which just uploads the files to blob but it doen not really look like a clean solution.
  • Use the ‘Deploy a NuGet package’ step. The problem is that it needs a tentacle and because we are only deploying to Azure we do not have one.
  • We can create a custom command in Calimari which does the deployment. We only do not know how to integrate this with the octopus server and how we can add a build step using this custom command.

We are using the latest version of Octopus.
Hope you can help us forward.

Thanks, Erwin Steffens

Hi Erwin,

Thanks for reaching out. You can use this step template to upload stuff to an azure blob: https://library.octopusdeploy.com/#!/step-template/actiontemplate-azure-blob-storage-upload

Keep in mind that you’re gonna have to run this step from a Tentacle. If you dont want to have a dedicated machine just for this, you can turn the Octopus server itself into a Tentacle and have it run this step.

Hope that helps!

Dalmiro

Hi Dalmiro,

We like the azure deployments steps because they are clean and there is no need to handle the Azure Subscription things. When we use this step we have the Azure account configuration in Octopus server and seperate publishsettings on the tentacles which is a pain to manage.

We have a need for an Azure package deploy step which can be run from the server.

Erwin

Hi Erwin,

In that case then you might wanna use the Azure Powershell Script step that was included in Octopus 3.0. It will let you use one of the subscriptions added to your Octopus instance, just like you do for Azure deployment steps. The scripts executed using this step will be executed from the Octopus Server box.

Hope that helps

Dalmiro

Ok thanks. But we cannot access package content from there can we?

Hi Erwin,

From that step you wont have access to the package contents. If you want to be able to run Azure cmdlets AND have access to the package contents, use the “Custom Deployment scripts” feature on your Azure web app deploy step (see screenshots). It’ll use the same Azure subscription you selected on that step.

Regards,

Dalmiro

Hi Dalmiro,

Thanks for the tip. We have a working solution now with a tentacle doing a package deploy with a custom scripts which loads the azure subscription.

Thanks, Erwin

Hi Dalmiro,
Our requirement is:
we have a ‘Releases’ cloud directory in Azure file storage (file service) where we hosting every new releases(as a directory) in this cloud directory.
cloud directory structure like:

  • Releases (cloud directory)
    • Release.4.8 (cloud directory)
    • Release.4.7 (cloud directory)
    • Release.4.6 (cloud directory)
    • Release.4.5 (cloud directory)
      we want to upload new release directory in ‘Releases’ cloud directory whenever we making the new release (like Release 4.9) using octopus deployment.

Here, i have tried web deploy with custom deploy script as you suggested. i am getting the following error message…

AzCopy : The term ‘AzCopy’ is not recognized as the name of a cmdlet, function,
09:15:38Error
script file, or operable program. Check the spelling of the name, or if a path
09:15:38Error
was included, verify that the path is correct and try again.
09:15:38Error
At C:\Octopus\Work\20160512034531-40\Octopus.Action.CustomScripts.PreDeploy.ps1
09:15:38Error
:2 char:1
09:15:38Error

  • AzCopy /Source:$OctopusParameters['Octopus.Tentacle.CurrentDeployment.Package
    09:15:38Error
    Fil …
    09:15:38Error

09:15:38Error
+ CategoryInfo : ObjectNotFound: (AzCopy:String) [], ParentContai
09:15:38Error
nsErrorRecordException
09:15:38Error
+ FullyQualifiedErrorId : CommandNotFoundException
09:15:38Error
09:15:38Error
Script ‘C:\Octopus\Work\20160512034531-40\Octopus.Action.CustomScripts.PreDeploy.ps1’ returned non-zero exit code: 1
09:15:38Error
Running rollback conventions…
09:15:38Error
Script ‘C:\Octopus\Work\20160512034531-40\Octopus.Action.CustomScripts.PreDeploy.ps1’ returned non-zero exit code: 1
09:15:38Fatal
The step failed: The remote script failed with exit code 1

could you guide me how to resolve the issue? do you have any suggestion for alternate deployment solution here?

Hi,

Thanks for reaching out. The error says AzCopy : The term 'AzCopy' is not recognized as the name of a cmdlet, function, etc. It appears that you are not calling AzCopy from the directory where this executable is sitting on. That should be a good enough lead to get this working.

Hope that helps,
Dalmiro