Created
March 28, 2024 16:18
-
-
Save riosengineer/6a43e96468851506d99ca17a23254126 to your computer and use it in GitHub Desktop.
bicep-deploy-sub.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trigger: | |
branches: | |
include: | |
- main | |
paths: | |
include: | |
# amend folder name / structure path to suit your repository | |
- bicep/connectivity-sub | |
variables: | |
- name: subscription | |
value: 'YOUR_SUB_GUID' | |
- name: azureServiceConnection | |
value: 'YOUR_SERVICE_CONNECTION_NAME' | |
- name: region | |
value: 'YOUR_AZURE_REGION' | |
pool: | |
vmImage: 'ubuntu-latest' | |
stages: | |
- stage: Build | |
displayName: Bicep Artifact | |
jobs: | |
- job: ArtifactDrop | |
displayName: 🔨 Build Bicep artifact | |
steps: | |
- task: CopyFiles@2 | |
displayName: Copy files | |
inputs: | |
contents: '**' | |
targetFolder: '$(Build.ArtifactStagingDirectory)' | |
- publish: '$(Build.ArtifactStagingDirectory)' | |
displayName: 'Publish files' | |
artifact: drop | |
- stage: whatIf | |
dependsOn: Build | |
displayName: What if | |
jobs: | |
- job: whatIfBicep | |
displayName: '🤔 What if' | |
steps: | |
- download: current | |
artifact: drop | |
- task: AzureCLI@2 | |
displayName: Bicep what if | |
inputs: | |
azureSubscription: $(azureServiceConnection) | |
scriptType: 'bash' | |
scriptLocation: 'inlineScript' | |
workingDirectory: $(Pipeline.Workspace)/drop/bicep/connectivity-sub | |
inlineScript: | | |
name=bicepDeploy$(date +%F_%H-%M-%S) | |
az deployment sub what-if -l $(region) -n $name -f main.bicep -p main.bicepparam | |
- stage: DeployConnectivity | |
dependsOn: whatif | |
variables: | |
jobs: | |
- deployment: prod | |
environment: 'production' | |
displayName: 'Deploy to Connectivity Subscription' | |
pool: | |
vmImage: $(vmImageName) | |
strategy: | |
runOnce: | |
deploy: | |
steps: | |
- download: current | |
artifact: drop | |
- task: AzureCLI@2 | |
displayName: Deploy Connectivity Sub | |
inputs: | |
azureSubscription: $(azureServiceConnection) | |
scriptType: 'bash' | |
scriptLocation: 'inlineScript' | |
workingDirectory: $(Pipeline.Workspace)/drop/bicep/connectivity-sub | |
inlineScript: | | |
name=connectivityDeploy$(date +%F_%H-%M-%S) | |
az deployment sub what-if -l $(region) -n $name -f main.bicep -p main.bicepparam |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment