0

I'm trying to assign a --query's returned id value into a variable as a string so that I can use the variable to input the id in other commands in Windows Powershell:

$repoID = az repos list --query "`"[?contains(name,'$Name')].id`""
az repos policy approver-count create --repository-id $repoID

but $repoID contains

[
"id value"
]

Would anyone know how to convert the return into a string so that $repoID = "id value" and becomes a valid parameter input?

Thanks in advance!

Vince
  • 15
  • 3

1 Answers1

0

Please use another output by setting -o tsv

$repoID = az repos list --query "`"[?contains(name,'$Name')].id`"" -o tsv
Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107