I need to add the azureSubscription to my each loop which looks like this
parameters:
- name: info
displayName: Information
type: object
default:
info1: abc
info2: 123
info3: hello
steps:
- checkout: none
- ${{ each info in parameters.info }}:
- script: |
echo "info1 is ${{ info.info1}}"
echo "info2 is ${{ info.info2}}"
echo "info3 is ${{ info.info3}}"
az keyvault secret set --vault-name ${{ parameters.info1 }} --name ${{ parameters.info2 }} --value ${{ parameters.info3 }}
displayName: Show ${{ info.key }} value
I tried adding it as an input and tried adding it without input but I get an unexpected parameter error
parameters:
- name: info
displayName: Information
type: object
default:
info1: abc
info2: 123
info3: hello
steps:
- checkout: none
- ${{ each info in parameters.info }}:
- inputs:
azureSubscription: subscriptionNumber
script: |
echo "info1 is ${{ info.info1}}"
echo "info2 is ${{ info.info2}}"
echo "info3 is ${{ info.info3}}"
az keyvault secret set --vault-name ${{ parameters.info1 }} --name ${{ parameters.info2 }} --value ${{ parameters.info3 }}
displayName: Show ${{ info.key }} value`
2
Answers
You can set an array of objects containing the keyvault secrets you want to update and then use
${{ each ... }}
to generate a script task for each one.Changing your code slightly to make it more readable:
Running the pipeline: