Neil70
Neil70

Reputation: 119

Azure DevOps Release Pipelines - Using Powershell with Pipeline variables inside brackets

I've entered into a bit of syntax nightmare, everything I have tried so far just will not work.

Its a single line...which works absolutely fine until I work in some Release Pipeline variables with the $(env:name-of-var) stuff...

$primarykey = (Get-AzRelayKey -ResourceGroupName $($env:az-resourcegroupname) -Namespace $($env:az-relaynamespace) -HybridConnection $($env:AF.actionResultRelayConnectionName) -Name $($env:AF.actionResultFalloverRelayKeyName) | Select-Object -ExpandProperty PrimaryKey)

Any ideas greatly received. Thanks in advance.

Upvotes: 1

Views: 584

Answers (1)

Shayki Abramczyk
Shayki Abramczyk

Reputation: 41565

Because you have - in the variable name you got an error.

You can do it in this way (instaed of $($env:az-...)):

${env:az-resourcegroupname}
${env:az-relaynamespace}

Upvotes: 3

Related Questions