View on GitHub

azure-certification-training

Notes and learning resources collected during my training to become a certified DevOps Engineer Expert.

1. Develop Azure compute solutions (25-30%)

1.1 Implement IaaS solutions

provision virtual machines (VMs)

configure container images for solutions

publish an image to the Azure Container Registry

  1. create ACR
    • navigate Azure Portal -> Create a Resource (+) -> Containers
      • pick Container registry
  2. login to ACR using Azure CLI: az acr login
  3. Dockerfile -> build -> tag -> push image to Azure Container Registry
  4. check image in repository: Azure Portal -> Container registry -> Repositories

run containers by using Azure Container Instance

  1. create ACI
    • navigate Azure Portal -> Azure Cloud Shell: Bash
      • Create rg: az group create --name learn-deploy-aci-rg --location eastus
    • example: create container with environment variables (db connection credentials ) and mounted volume (Azure file share)
        az container create \
            --resource-group learn-deploy-aci-rg \
            --name mycontainer \
            --image microsoft/aci-helloworld \
            --ports 80 \
            --dns-name-label $DNS_NAME_LABEL \
            --location eastus
            --environment-variables \
                COSMOS_DB_ENDPOINT=$COSMOS_DB_ENDPOINT \
                COSMOS_DB_MASTERKEY=$COSMOS_DB_MASTERKEY
            --azure-file-volume-account-name $STORAGE_ACCOUNT_NAME \
            --azure-file-volume-account-key $STORAGE_KEY \
            --azure-file-volume-share-name aci-share-demo \
            --azure-file-volume-mount-path /aci/logs/
      
  2. Check status
     az container show \
         --resource-group learn-deploy-aci-rg \
         --name mycontainer \
         --query "{FQDN:ipAddress.fqdn,ProvisioningState:provisioningState}" \
         --output table
    
  3. Check logs
     az container logs \
         --resource-group learn-deploy-aci-rg \
         --name mycontainer-restart-demo
    
  4. Attach to container (receive events)
     az container attach \
         --resource-group learn-deploy-aci-rg \
         --name mycontainer
    
  5. Monitor container (CPUUsage, MemoryUsage)
     az monitor metrics list \
         --resource $CONTAINER_ID \
         --metrics CPUUsage \
         --output table
    

1.2 Create Azure App Service Web Apps

create an Azure App Service Web App

enable diagnostics logging

deploy code to a web app

  1. build app
  2. deploy web app using Azure Pipelines
    • Web Deploy package (ASP.NET)
      • azure-pipelines.yml task:
            - task: AzureWebApp@1
              inputs:
                  azureSubscription: '<Azure service connection>'
                  appName: '<Name of web app>'
                  package: $(System.DefaultWorkingDirectory)/**/*.zip
                  slotName: staging
        
      • locally: Visual Studio > Solution Explorer -> Publish -> Target: Azure -> App Service -> Sign in
        • select resource group + App Service instance
    • Alternative: Push from Git
      • git remote add azure <deploymentLocalGitUrl-from-create-step>
      • git push azure master

configure web app settings including SSL, API settings, and connection strings

1.3 Implement Azure functions

create and deploy Azure Functions apps

implement input and output bindings for a function

  1. configure project for local development
  2. add appropriate NuGet extension package for specific binding
    • example: C# class library > Event Hubs trigger
  3. add binding settings to the Values collection in local setting file
  4. add appropriate binding attribute to the method signature
    • example:
      • input binding/function trigger = queue message
      • output binding = create new queue message in different queue
          public static class SimpleExampleWithOutput
          {
              [FunctionName("CopyQueueMessage")]
              public static void Run(
                  [QueueTrigger("myqueue-items-source", Connection = "AzureWebJobsStorage")] string myQueueItem, 
                  [Queue("myqueue-items-destination", Connection = "AzureWebJobsStorage")] out string myQueueItemCopy,
                  ILogger log)
              {
                  log.LogInformation($"CopyQueueMessage function processed: {myQueueItem}");
                  myQueueItemCopy = myQueueItem;
              }
          }
        

implement function triggers by using data operations, timers, and webhooks

implement Azure Durable Functions

Design patterns

implement custom handlers