In Azure pipelines, I have a Powershell task (inline script), where I set a variable
Write-Host "##vso[task.setvariable variable=deployActivity]false"
Immediately afer this line, just for checking purposes that the variable is set, I have the following powershell -
if ($(deployActivity) -eq $true) {
Write-Host "deployActivity=true (bool)"
}
However, this is failing with the error:
deployActivity : The term 'deployActivity' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Questions -
- What am doing above, to retrieve the variable - is it correct/possible? Or is it that a variable can only be refrenced in the follow-up tasks
- Why is it failing? Is the referencing of variable in Powershell needs to have any other syntax?
Kindly let me know.
Thanks