Modify deployment label without custom DeployToAzure.ps1


Is it possible to set a custom value for the $OctopusAzureDeploymentLabel parameter provided to the DeployToAzure.ps1 script, without requiring a custom DeployToAzure.ps1 file in the nupkg?

E.g., can I set it to a value similar to this?

$OctopusAzureDeploymentLabel = $OctopusParameters["Octopus.Release.Number"] + " (" + ([DateTime]::Now.ToString("dd MMM yyyy @ HHmm")) + ")"

Hi Xavier,

Thanks for getting in touch. Unfortunately, the answer is no. I looked up where this is used and we set it as an output variable with the following line of code which is then used in the actual deployment script.

You can look at the source code for this because it’s open source and available on github.

It’s important to note that this is available as an output variable to use in your own scripts if desired. For more information on this, you can read about it at the following URL.

Out of curiosity, can you tell me why you want to override this?



Hi Rob,

Thanks for the detailed answer!
It would be cool if we could somehow provide our own DeploymentLabel value as a parameter to that script, and fallback to the current default implementation when no parameter value was provided.

Reason I want to tweak it is that I basically want to get rid of the custom DeployToAzure.ps1 I was currently using, and the only thing it was still used for was setting the custom deploymentlabel.

Our labels look like: TeamCityBuildNumber-branchname (DD MMM YYYY @ HHmm), e.g. "3.0.2122-master (17 Aug 2016 @ 1639)"
This is much more convenient in the Azure portal than the long default value including deployment step name etc (which requires a mouse-over to actually read the meaningful parts of the label :)).

Is supporting an optional parameter with current behavior as a fallback something you might consider?

Best regards,

It could be cool if simply setting the variable in a pre-deployment script was possible:

$releaseNumber = $OctopusParameters['Octopus.Release.Number']
$OctopusAzureDeploymentLabel = 
    $releaseNumber + " (" + ([DateTime]::Now.ToString("dd MMM yyyy @ HHmm")) + ")"

# Somehow pass this $OctopusAzureDeploymentLabel parameter on to 
# the DeployToAzure.ps1 script which checks the value or falls back 
# to default behavior

Write-Host "Set deployment label to `"$OctopusAzureDeploymentLabel`""

Hi Xavier,

I’m sorry for the slow reply but I didn’t want to follow-up until I had made the change. This is done now as I merged the change this morning so it should be included in the next Octopus release (3.4.4) which should be available shortly. To specify the custom label, simply add or set a variable named Octopus.Action.Azure.DeploymentLabel for your project and it will be used in place of the default.

Hope this helps!


Hi Rob,

That is simply awesome! :slight_smile:
Thanks for making this happen!



This issue has been closed due to inactivity. If you encounter the same or a similar issue and require help, please open a new discussion (if we asked for logs or extra details in this thread, consider including them in the new thread). If you are the creator of this thread and believe it should not be closed let us know via our support email.