0

I have a deployment group job which executes a PowerShell script and returns a value.

the output of the PowerShell task in azure DevOps console -

2019-12-31T16:57:11.2860409Z ##[command]"C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'C:\AzurePiplinesAgent_Extension\_work\_temp\ff9189f4-abc8-476f-868e-cb6e2c502d22.ps1'"
2019-12-31T16:59:26.5696135Z **tdeJTKF9pono3xkdYnKVcTEyID9cJCJqGb0xWaGAhjg**
2019-12-31T16:59:26.6240777Z ##[section]Finishing: install-configure-key

I want to assign this value to an output variable and use that in the next task in the same deployment variable.

1st task, I have configured the output variable

enter image description here

and the referring this in the subsequent task:

enter image description here

I am getting the below error message:

The term 'key.VariableName' 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.

can someone help me with this?

6
  • Update your question to include the script that's supposed to set the output variable. Did you read the documentation on output variables? Commented Dec 31, 2019 at 17:13
  • I am reading a log file for retrieving a password from a file . This is the powershell script which i am excuting from azure devops pipeline $key = ((Get-Content $secretlogfile | Where-Object { $_.Contains("KEY") }).Split('=')[-2]).replace(" ","") Write-Host $key and i am trying to store this $key to the output variable which i am going to use in the subsequent task for storing this in the azure key vault. Commented Dec 31, 2019 at 19:51
  • Did you try looking up the documentation on the syntax for setting pipeline variables? Commented Dec 31, 2019 at 20:06
  • 1
    I was able to fix the issue., used this line for storing the output variable -> Write-Output "##vso[task.setvariable variable=value;isOutput=true]$key" the output variable name i used was key and in the subsequent task i used $password = '$(key.value)' and it worked. Commented Dec 31, 2019 at 22:53
  • 2
    @krishna Glad you were able to figure it out. Please summarize your findings as an answer below so it can help others in the community who might have similar questions. Thanks! Commented Jan 4, 2020 at 17:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.