Skip to content

Instantly share code, notes, and snippets.

@ehrnst
Created December 13, 2019 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ehrnst/a8f97d635eb8f1d5e5a7c6f21b8fdd01 to your computer and use it in GitHub Desktop.
Save ehrnst/a8f97d635eb8f1d5e5a7c6f21b8fdd01 to your computer and use it in GitHub Desktop.
Yaml pipeline with powershell
trigger:
- master
variables:
# Agent VM image name
vmImageName: 'windows-2019'
# service connection (azure)
azureServiceConnection: '{{ azServiceConnection }}'
# SubscriptionId to use in deployment scripts
customerSubscriptionId: 'f1eb90a1************'
stages:
- stage: Build
displayName: copy files (build)
jobs:
- job: Build
displayName: Build
pool:
vmImage: $(vmImageName)
steps:
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.SourcesDirectory)'
artifact: 'drop'
publishLocation: 'pipeline'
- stage: Deploy
displayName: 'Deploy stage'
dependsOn: Build
jobs:
- deployment: Deploy
displayName: 'Deploy Az resources'
pool:
vmImage: $(vmImageName)
environment: $(customerSubscriptionId)
strategy:
runOnce:
deploy:
steps:
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
artifactName: 'drop'
itemPattern: '**/*'
targetPath: '$(Pipeline.Workspace)'
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
# anything here?.
dir
- task: AzurePowerShell@4
displayName: 'Log analytics'
inputs:
azureSubscription: 'Azure Lighthouse BluePrint'
ScriptType: 'FilePath'
ScriptPath: '$(Pipeline.Workspace)/drop/ARM-Templates/logAnalytics/deploy.ps1'
ScriptArguments: '-subscriptionId $(customerSubscriptionId)'
azurePowerShellVersion: 'LatestVersion'
pwsh: true
- task: AzurePowerShell@4
displayName: 'Security center'
inputs:
azureSubscription: 'Azure Lighthouse BluePrint'
ScriptType: 'FilePath'
ScriptPath: '$(Pipeline.Workspace)/drop/ARM-Templates/securityCenter/deploy.ps1'
ScriptArguments: '-subscriptionId $(customerSubscriptionId)'
azurePowerShellVersion: 'LatestVersion'
pwsh: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment