Forum Discussion
vishalb535
Jan 23, 2023Copper Contributor
Unable to get output variable value in the deploy stage
Hi, I am trying to fetch variable value in deployment stage but I am unable to get variable value trigger: none jobs: -job: GetTemplateAndPar - task: PowerShell@2 name: GetFun...
varunmittal
Jan 25, 2023Copper Contributor
It looks like you are trying to access the value of the variable "varFuncAppsToDeploy" in your deployment stage, which was set in the previous job "GetTemplateAndPar" using the PowerShell task.
In order to access the variable in the deployment stage, you need to reference it using the correct syntax.
In your deployment stage, you can use the following syntax to access the variable:
$(dependencies.GetTemplateAndPar.outputs['setVariable.varFuncAppsToDeploy'])
You can also use the following way of accessing it
$(varFuncAppsToDeploy)
Note that the variable must be marked as an output variable using the "isOutput=true" flag in the PowerShell script, as you have done in your script.
You might also need to check the pipeline's log files to see the variable's value and if it's being set or not.
Also make sure that you are running the bash task in the same agent where the variable was set.
In order to access the variable in the deployment stage, you need to reference it using the correct syntax.
In your deployment stage, you can use the following syntax to access the variable:
$(dependencies.GetTemplateAndPar.outputs['setVariable.varFuncAppsToDeploy'])
You can also use the following way of accessing it
$(varFuncAppsToDeploy)
Note that the variable must be marked as an output variable using the "isOutput=true" flag in the PowerShell script, as you have done in your script.
You might also need to check the pipeline's log files to see the variable's value and if it's being set or not.
Also make sure that you are running the bash task in the same agent where the variable was set.