Achieving end-to-end traceability between Azure and Azure DevOps!

Azure DevOps is great for automating your releases to Azure.  On your Azure pipeline, you have an instant overview of the deployment: what source code is being deployed and to which environments?  Unfortunately, you don’t have that visibility in Azure.  When you discover some bugs in Azure, you easily want to understand when the last deployment occurred and what source code was deployed.  This can be done with a little trick!

In your Bicep file, add an optional parameter and assign it as a tag on your resource group.

param devOpsUrl string = ''
//Create Resource Group
resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
  name: 'tvh-dev-temporary-rg'
  location: location
  tags: {
    environment: 'dev'
    devOpsUrl: devOpsUrl
In your Azure DevOps pipeline, you can use built-in variables to pass the URL of the appropriate Azure pipeline to the devOpsUrl parameter.  In classic pipelines, you could use the Release.ReleaseWebURL variable for this.  In YAML pipelines, you need to do a little more plumbing, as shown in the example below.
- task: AzureCLI@2
    displayName: 'Deploy infra'
       azureSubscription: '${{ parameters.serviceConnection }}'
       scriptType: 'pscore'
       scriptLocation: 'inlineScript'
       inlineScript: |
          az deployment sub create  `
          --location westeurope `
          --template-file infra.bicep `
          --parameters infra.parameters.${{ parameters.environment }}.json `
          --parameters "devOpsUrl=$($env:SYSTEM_COLLECTIONURI)$($env:SYSTEM_TEAMPROJECT)/_build/results?buildId=$($env:BUILD_BUILDID)&view=results"
       workingDirectory: '$(Pipeline.Workspace)/infra'
As a result, your Azure resource group always contains a link to the most recent Azure DevOps pipeline!  This can be very useful when troubleshooting!



Your Azure Coach is specialized in organizing Azure trainings that are infused with real-life experience. All our coaches are active consultants, who are very passionate and who love to share their Azure expertise with you.