Skip to content

Instantly share code, notes, and snippets.

@johnlokerse
Last active October 1, 2023 19:36
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 johnlokerse/c89cad55afcd1431e9c803cc61bd9576 to your computer and use it in GitHub Desktop.
Save johnlokerse/c89cad55afcd1431e9c803cc61bd9576 to your computer and use it in GitHub Desktop.
Work with environment variables in Azure Bicep blog
parameters:
- name: Environment
type: string
default: dev
values:
- prod
- acc
- tst
- dev
pool:
vmImage: 'windows-latest'
variables:
- name: Environment
value: ${{ parameters.Environment }}
steps:
- powershell: |
$random = -join ((65..90) + (97..122) | Get-Random -Count 10 | ForEach-Object {[char]$_})
Write-Output "##vso[task.setvariable variable=RandomizedString]$random"
displayName: 'Set a variable from pipeline'
- task: AzureCLI@2
inputs:
azureSubscription: 'spn-readEnvironmentVariable'
scriptType: 'pscore'
scriptLocation: 'inlineScript'
inlineScript: |
az deployment group create --template-file ./demo.bicep --parameters ./demo.bicepparam --resource-group rg-playground
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment