Passing ARM output variables to Powershell steps, empty variable in PowerShell

Hi,

Octopus 3.3.6

I’m trying to pass variables from an ARM template output step to a powershell step, but the PowerShell thinks the template value is empty, so the powershell fails.

ARM Template:

“outputs”: {
“WebSiteResourceId”: {
“type”: “string”,
“value”: “[resourceId(resourceGroup().name,‘Microsoft.Web/sites’, variables(‘webSiteName’))]”
}

Step name in Octopus is: “deploy-web-app”

PowerShell Script is:

$endpoint = $OctopusParameters[“Octopus.Action[deploy-web-app].Output.AzureRMOutputs[WebSiteResourceId]”]
Write-Host "Adding endpoint " $endpoint

The $endpoint is empty

What am I doing wrong?

Hi,

Thanks for reaching out. I’m afraid that catching the output of an ARM template like that is not possible at the moment. Feel free to add it as a uservoice suggestion to see if the community would find this enhancement useful: http://octopusdeploy.uservoice.com/

Regards,
Dalmiro

Umm… majorly confused here.

Last section states:

Accessing ARM template output parameters
Any outputs from the ARM template step are made available as Octopus output-variables automatically. For example, an output Foo would be available as:

Octopus.Action[ArmTemplateStepName].Output.AzureRMOutputs[Foo]

Which bit is not possible?

also interested in this exact situation.

Bump for interest also

Any update on this? To be frank User Voice is usually a place where ideas go to die… and from the documentation this actually appears to be a bug?

Hi,

Sincere apologies for the delay on this. I’ve just setup a test and the output variables do get handled and passed in to subsequent step correctly.

To troubleshoot why it might not be working for you, could I get you to check the output from the Resource Group step? There should be a line right near the end that reads “Provisioning State: Succeeded”. If you view the Verbose output then just below this should be the json for the template output. Does that appear and does it have the correct values substituted in?

If you have a variable in the project called OctopusPrintVariables that is set to True, then in the Verbose output for the second step you should be able to see the variable values being passed in. To find the one I’m after I typically expand any “additional lines not shown” sections and then text search the page for the variable name, e.g. WebSiteResourceId in your scenario. Can you find the variable in the list and if so is it’s value correct? If it is there and correct, could you also double check that the full name being passed in is Octopus.Action[deploy-web-app].Output.AzureRMOutputs[WebSiteResourceId]?

Again, apologies for the delay.

Regards
Shannon

Can confirm that we have output variables functioning as expected.

Using the “Deploy Azure Resource” step, where you specify a template and params.json file.

Hi,

I will get round to this shortly, it’s on my TODO list

Graham