Mid DevOps

After deployment, Azure Pipelines can report live data to App Insights (like response time, failed requests, or exceptions). Example (YAML): - task: AzureCLI@2 inputs: azureSubscription: 'MyServiceConnection' scriptType: 'bash' scriptLocation: 'inlineScript' inlineScript: | echo "Checking App Insights availability..." az monitor metrics list --resource myapp --metric requests/count Example scenario: After a new deployment, your team monitors App Insights dashboards — noticing that response times increased by 20%. They can quickly roll back or optimize performance before users notice. ✅ Pro Tip: Combine these tools for full visibility: ● Azure Pipelines logs → Diagnose build/deployment failures. ● Azure Monitor + App Insights → Track live app performance. ● Power BI / Analytics → Measure DevOps effectiveness. ● Dashboards → Share live health status with your whole team. Follow: Infrastructure as Code (IaC) & Automation 1⃣ How do you provision infrastructure in Azure using ARM, Bicep, or Terraform via Azure DevOps?

You can automate infrastructure deployment directly from Azure Pipelines using ARM

templates, Bicep files, or Terraform scripts.

Each option defines your infrastructure as code — meaning servers, networks, and

resources are described in files and deployed consistently through pipelines.

✅ Example (using Bicep in YAML):

trigger:

  • main

pool:

vmImage: 'ubuntu-latest'

steps:

  • task: AzureCLI@2

inputs:

azureSubscription: 'MyServiceConnection'

scriptType: 'bash'

scriptLocation: 'inlineScript'

inlineScript: |

az deployment group create \

  • -resource-group MyRG \
  • -template-file infrastructure/main.bicep \
  • -parameters environment=dev appName=myapp

✅ Example (using Terraform):

  • task: TerraformInstaller@1

inputs:

terraformVersion: '1.7.0'

Follow:

  • task: TerraformCLI@1

inputs:

command: 'init'

workingDirectory: 'infra'

  • task: TerraformCLI@1

inputs:

command: 'apply'

workingDirectory: 'infra'

commandOptions: '-auto-approve'

environmentServiceName: 'MyServiceConnection'

Example scenario:

A DevOps pipeline runs when a pull request is merged into main, automatically provisioning

an Azure App Service, Storage Account, and SQL Database using Bicep.

2⃣ What is the difference between ARM templates and Bicep?

Feature ARM Templates Bicep

Language JSON Domain-specific (simpler syntax)

Readability Complex, verbose Clean and concise

Reusability Harder (manual

nesting)

Supports modules easily

Tooling Native in Azure Compiles into ARM JSON

Learning curve Steep Easier for beginners

In short:

Bicep is the modern, simplified language for ARM templates.

It makes infrastructure code shorter and easier to read — but still deploys through the same

Azure Resource Manager (ARM) engine.

Example comparison:

Follow:

ARM Template (JSON):

"resources": [

"type": "Microsoft.Storage/storageAccounts",

"name": "[parameters('storageName')]",

"location": "[resourceGroup().location]",

"sku": { "name": "Standard_LRS" },

"kind": "StorageV2"

Bicep (same thing):

resource storageAccount

'Microsoft.Storage/storageAccounts@2022-09-01' = {

name: storageName

location: resourceGroup().location

sku: { name: 'Standard_LRS' }

kind: 'StorageV2'

Example scenario:

A cloud engineer switches from ARM to Bicep and cuts a 300-line template down to just 80

lines — making it much easier to maintain in Git.

3⃣ How do you use Azure Service Connections for IaC deployments?

An Azure Service Connection securely stores credentials that pipelines use to connect to

your Azure subscription.

It’s like giving your pipeline “keys” to deploy resources in Azure — without hardcoding

credentials.

How to create one:

Follow:

More from Microsoft Azure Tutorial

All questions for this course