Author : MD TAREQ HASSAN | Updated : 2021/10/27
Create YAML Files
azure-pipelines-pulumi-up.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:
- task: UseDotNet@2
displayName: 'Use .NET 6.0 sdk'
inputs:
packageType: 'sdk'
version: '6.0.x'
includePreviewVersions: true
- task: Pulumi@1
inputs:
azureSubscription: 'xxx-sc' # sc -> service connection
command: up
loginArgs: 'azblob://pulumi-backend-container'
args: '--yes'
stack: dev
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)
azure-pipelines-pulumi-destroy.yml
pool:
vmImage: 'ubuntu-latest'
#
# Import KeyVault secrets by linking Variable Group
#
variables:
- group: "pulumi-secrets-vg"
jobs:
- job: PulumiDestroyJob
displayName: Pulumi Destroy Job
steps:
- task: Pulumi@1
inputs:
azureSubscription: 'xxx-sc' # sc -> service connection
command: destroy
loginArgs: 'azblob://pulumi-backend-container'
args: '--yes'
stack: dev
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)
Create Pipelines
- Pipelines > New Pipeline
- Select “Azure Repos Git (YAML)”
- Select the target repository in the DevOps project
- Configure: Existing Azure Pipelines YAML File
- Path: select target yaml file > Continue
- Save
- Go to pipelines again > click on more opntions (virtical dots) of newly created pipeline > Rename / Move
- Repeast the process to add more pipelines from different yaml file