Author : MD TAREQ HASSAN | Updated : 2021/10/27

Create task template

Create step template: PipelineTemplates/pulumi-task.yml

parameters:
- name: command
  type: string
- name: stack
  type: string
  default: dev

steps:
- task: Pulumi@1
  inputs:
    azureSubscription: 'xxx-sc'
    command: $
    loginArgs: 'azblob://xxx-container'
    args: '--yes'
    stack: $
  env:
    AZURE_STORAGE_ACCOUNT: $(AZURE-STORAGE-ACCOUNT)
    AZURE_STORAGE_KEY: $(AZURE-STORAGE-KEY)
    AZURE_CLIENT_ID: $(AZURE-CLIENT-ID)
    AZURE_CLIENT_SECRET: $(AZURE-CLIENT-SECRET)
    AZURE_TENANT_ID: $(AZURE-TENANT-ID)

Use task template

Use template in azure-pipelines.yml

pool:
  vmImage: 'ubuntu-latest'

#
# Import KeyVault secrets by linking Variable Group
#
variables:
- group: "pulumi-secrets-vg"


jobs:
- job: PulumiUpJob
  displayName: Pulumi Up Job
  steps:
  - template: PipelineTemplates/pulumi-task.yml
    parameters: 
      command: up