I’ve migrated to 3.3.1 from 3.2.24 and can’t understand why the PS script I use does not “see” variables provided.
My PS Script (createNewEnv.ps1) section with Params:
[CmdletBinding()]
param(
[string]$location = “North Europe”,
[string]$envPrefix,
[string]$subscrName = “Subscrname#21”,
… some other
When I use “Run a Script” step based on Custom template with all the vars set the same as below, where I switched to “Script file inside a package” option.
Script file name is filled: createNewEnv.ps1 and package Id is the same as in Nuget feed I’ve unpacked before (see below).
In parameters I have all the vars defined as follows (for “location” var):
Variable name: location
Default value: #{location}
Control type: SingleLine text box
But after re-build & deployment in Octopus I got errors saying that PS Script createNewEnv.ps1 can’t binf empty String to the value.
I suppose it’s referring to the envPrefix param missing value.
Previous version of Custom template that worked was the following:
1 Step: I’ve unpacked Nuget feed via WebApp package + Custom extract directorywas set env-dependent path (C:\scripts#{EnvPrefix}\Azure Deployment Scripts New).
2nd Step: PS Script step with source code:
Write-Host “-------------------------------- THIS STEP WILL PERFORM ENVIRONMENT UPGRADE -------------------------”
&“C:\scripts#{EnvPrefix}\Azure Deployment Scripts New\createNewEnv.ps1” -envPrefix #{EnvPrefix} -envType #{EnvType} -location #{location} -tier #{tier} -subscrName #{subscrName} -username #{DeployUser} -password #{DeployUserPassword}
Here all the Vars are passed to the script implicitly.