Action variables are null during azure powershell step?

We are using Octopus cloud, and have a pretty simple configuration where we deploy to an Azure WebApp using a deployment target. We then follow up the deployment with an Azure powershell script step that tweaks certain things in the app according to tenant variables.

However, we haven’t been able to access the target WebApp name (or slot name) in the powershell script using Octopus variables. We’re attempting to do the following:

$siteName = $OctopusParameters[“Octopus.Action.Azure.WebAppName”]
$slotName = $OctopusParameters[“Octopus.Action.Azure.WebAppSlotName”]
$app = Get-AzureRmWebAppSlot -ResourceGroupName $resourceGroup -Name $siteName -Slot $slotName

…but the Octopus parameters are always blank. (We’ve tried every variable we can find that might be relevant)

Is there anyway to access the name of the Azure webapp to which we just deployed from this powershell script?

We were able to solve this by embedding the script in the actual step to deploy the web app. At that point the variables are populated.


Thanks for getting in touch! That’s great to hear you’ve been able to resolve this by embedding it into the web app step. It looks like the reason why it wasn’t working in the standalone script step is because the step name that populates these system variables wasn’t specified in the variable. Something like this should work in this case:

$siteName = $OctopusParameters[“Octopus.Action[WebAppStepName].Azure.WebAppName”]
$slotName = $OctopusParameters[“Octopus.Action[WebAppStepName].Azure.WebAppSlotName”]

Don’t hesitate to reach out if you have any further questions or concerns in the future. :slight_smile:

Best regards,


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