Say I have a main azure devops pipeline azure-pipelines.yml in which I call into my template deploy.yml.
In the main pipeline I'd like to be able to declare either a variable or a parameter of type hashset / map / dictionary or any other key value structure that I can then pass to the template.
I can see that it's possible to pass in an object type, but I can't wrap my head it's usage. How could I achieve the following?
Note the appSettings: {"key1":"value1","key2":"value2"}
in azure-pipelines.yml is a fantasy, but showcases pretty well how I'd like this to work.
azure-pipelines.yml:
trigger:
- main
- job: deploy
pool:
vmImage: ${{ parameters.poolVmImage }}
steps:
- template: deploy.yml
parameters:
azureServiceConnection: ${{ parameters.azureServiceConnection }}
resourceGroupName: 'foo'
appServiceName: 'bar'
appSettings: {"key1":"value1","key2":"value2"}
deploy.yml:
parameters:
- name: azureServiceConnection
- name: resourceGroupName
- name: appServiceName
- name: appSettings
steps:
- task: AzureCLI@2
displayName: Deploy zip
name: deployZip
inputs:
azureSubscription: ${{ parameters.azureServiceConnection }}
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az webapp deployment source config-zip \
-g ${{ parameters.resourceGroupName }} \
-n ${{ parameters.appServiceName }} \
--src ./deployment.zip
az webapp config appsettings set \
-g ${{ parameters.resourceGroupName }} \
-n ${{ parameters.appServiceName }} \
--settings ${{ parameters.appSettings }}