kumar
kumar

Reputation: 9387

VSTS Group Variables not able to use through Powershell task

I crated VSTS Group Variables with link with secrets from Azure Key Vault it contains SSH key.

As one of my Build task I am using Powershell task where I am passing the argument

-keyname $(vsts-ssh)

To see if it is retrieving the key propel I am printing it in powershell

Param(
[string] $keyname
)

Write-Host "hi there"
Write-Host $keyname

But the output is

hi there

-----BEGIN

The out put has only first few words and that is it.

am i doing something wrong on how I am using the variable

Upvotes: 2

Views: 458

Answers (2)

Eddie Chen - MSFT
Eddie Chen - MSFT

Reputation: 29966

Pass the argument like this:

-keyname "$(vsts-ssh)"

Upvotes: 0

Marina Liu
Marina Liu

Reputation: 38106

To troubleshot the issue, please check with below aspects:

1. Check if the vault secret has been added correctly in vriable group

In your variable group, make sure the vault sccret vsts-ssh has been added as variable in variable group (as the vault sccret sqlpassword in below example).

enter image description here

2. Check if the variable group has been linked to your build definition

In your build definition, please check if the variable group with the secret vsts-ssh (as the vault sccret sqlpassword in my example) has been linked.

enter image description here

Upvotes: 2

Related Questions