'Azure DevOps (az apim nv create) cant able to create variable dynamically
I'm trying to create multiple values using "az apim nv create" command using loop, but its not working.
with the single command (without using variable in --value) we can able to create, but the same is not working when we use variable in --value.
demo="fromkey fromkey1"
for list in $demo
do
az apim nv create --service-name ABC -g XYZ --secret true --named-value-id $list --display-name $list --value $list
done
Can someone please help on this.
Solution 1:[1]
Azure DevOps (az apim nv create) cant able to create variable dynamically
You could try below scripts in the bash task:
- bash: |
demo=( "fromkey" "fromkey1" )
for list in ${demo[@]}; do
az apim nv create --service-name ABC -g XYZ --secret true --named-value-id $list --display-name $list --value $list
done
displayName: 'az apim nv create'
env:
AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)
Update:
I this can be possible with Shell script ? if Yes then can you please share shell script commands
declare -a demo=("fromkey1" "fromkey2" "fromkey3")
for list in "${demo[@]}"
do
az apim nv create --service-name ABC -g XYZ --secret true --named-value-id $list --display-name $list --value $list
done
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
