Azure "On behalf of" variables

I’m setting up a deployment to an Azure App Service, using the “DEPLOY AN AZURE APP SERVICE” step.

I have Step 1 completing successfully.

Step 2, I’m using “Run an Azure Script” to swap deployment slots.

I need the resource group, slot name, and web app name from Step 1 in Step 2, but appears to not be available?

I’ve set OctopusPrintEvaluatedVariables = true and OctopusPrintVariables = true, and I don’t see the values I need during step 2.

Hi @seanl,

Thanks for reaching out, I’d be happy to help with variable references in your deployment process!

Our System Variables documentation mentions all of the variables that are available for Azure, however I find often find it easiest to use our ‘Insert Variable’ tool which will auto populate the details for the desired variable, look for a button next to the script that looks like #{}:

I was able to find the following variables to reference the WebApp Resource Group, Name and Slot in a Run An Azure Script step which is running on a worker on behalf of the target WebApp:

# Resource Group
write-host $OctopusParameters["Octopus.Action.Azure.ResourceGroupName"]

# WebApp Name
write-host $OctopusParameters["Octopus.Action.Azure.WebAppName"]

# WebApp Slot
write-host $OctopusParameters["Octopus.Action[Deploy an Azure App Service].Azure.DeploymentSlot"]

Looking forward to hearing how you get on, feel free to reach out if you have any questions at all!

Best Regards,

Finnian, thanks for the reply. I realize now I was attempting to reach back to Step 1 for multiple deployment targets when I needed to add the same “On Behalf of” parameters to Step 2 so it’ll run against the same targets as Step 1.

Please close this ticket, and thanks for the help.

2 Likes

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.