A DevOps journey using Azure DevOps

This is a workshop/lab setup that I created; it is going to take you through a DevOps journey using Azure DevOps. From setting up your pipeline to deploying an application to your Azure Kubernetes cluster!

This is also my contribution to this years Festive Tech Calendar – don’t forget to check out this content, its awesome!

GitHub repository to this workshop/lab

What you will learn

n this tutorial/lab, you will learn:

  • Initial setup of Azure DevOps to begin deploying to Azure using Pipelines as code
  • Deploy Azure resources using Terraform modules
  • Deploy a test application to Azure Kubernetes Service
  • An understanding of CI/CD with automated application deployments
  • Test your deployed Azure resources using automated testing
  • Reviewing monitoring and alerting using Application & Container Insights

This setup is based on a somewhat “real-life” scenario and setup mirrors an example of a real-world setup!

Tutorial/labs format

Prior to starting the tutorial/labs – please review the below Prerequisites Prerequisites

Labs are found here, complete each one in number sequence 1…2…3…etc

  1. Initial Setup starts you off with setting up:
  2. Setup Azure DevOps Pipeline The purpose of this lab is to create all of the Azure cloud services you’ll need from an environment/infrastructure perspective to run the test application.
  3. Deploy Application to Azure Container Registry Deploy sample Application to Container Registry.
  4. Deploy Application to Azure Kubernetes Cluster
  5. Introduce CI/CD
  6. Testing your deployed Azure Infrastructure
  7. Monitoring and Alerting


CI/CD

You will learn how to setup and configure a pipeline that involves CI/CD

  1. Developer changes application source code.
  2. Application is committed to the source code repository in Azure Repos.
  3. Continuous integration triggers application build
  4. Continuous deployment within Azure Pipelines triggers an automated deployment with environment-specific configuration values.
  5. Updated Application is deployed to environment specific Kubernetes cluster
  6. Application Insights collects and analyzes health, performance, and usage data.
  7. Azure Monitor collects and analyzes health, performance, and usage data.

Thank you!

Thank you for taking the time to work on this tutorial/labs. Let me know what you thought!

19 comments

  1. This is exactly what I need for my cloud journey. Thanks for sharing this. Unfortunately, I’m getting an error on step 2. Should I go around it by manually running the Terraform scripts or do you have some tips?

    Jason Thornbrugh

    2022-01-04T19:13:57.8711832Z [command]/opt/hostedtoolcache/terraform/0.15.4/x64/terraform init -backend-config=storage_account_name=devopsjourneyjt -backend-config=container_name=tfstate -backend-config=key=terraform.tfstate -backend-config=resource_group_name=devops-journey-rg -backend-config=subscription_id=45a8f18c-9e23-485e-8b22-b6160c0d34d4 -backend-config=tenant_id=*** -backend-config=client_id=*** -backend-config=client_secret=***
    2022-01-04T19:13:57.8842433Z ##[error]Error: There was an error when attempting to execute the process ‘/opt/hostedtoolcache/terraform/0.15.4/x64/terraform’. This may indicate the process failed to start. Error: spawn /opt/hostedtoolcache/terraform/0.15.4/x64/terraform ENOENT

  2. hi Thomas,

    many thanks for creating & sharing this resource.

    i am completely new and using this as guide, currently I’m stuck at running the pipeline

    error details

    │ Error: Failed to get existing workspaces: Error retrieving keys for Storage Account “devopspraxstg”: storage.AccountsClient#ListKeys: Failure responding to request: StatusCode=403 — Original Error: autorest/azure: Service returned an error. Status=403 Code=”AuthorizationFailed” Message=”The client ‘0a6fd422-1965-4ccb-9f41-b8a70ed23871’ with object id ‘0a6fd422-1965-4ccb-9f41-b8a70ed23871’ does not have authorization to perform action ‘Microsoft.Storage/storageAccounts/listKeys/action’ over scope ‘/subscriptions/5c1728b3-3e47-4c03-9bc8-a54abe9c334f/resourceGroups/devops-journey-rg/providers/Microsoft.Storage/storageAccounts/devopspraxstg’ or the scope is invalid. If access was recently granted, please refresh your credentials.”

    i have attempted to grant owner permission to the storage account but issue persist.

    thank for your help

    1. Sorry I missed this message. did you get it sorted?

      It looks like you dont have a storage account created?

      Have you ran through the pre-req steps?

      Thanks

  3. Hi Thomas,

    Thank you for creating and sharing the labs.

    I am currently stuck on running the pipelines, below is error

    │ Error: Failed to get existing workspaces: Error retrieving keys for Storage Account “devopspraxstg”: storage.AccountsClient#ListKeys: Failure responding to request: StatusCode=403 — Original Error: autorest/azure: Service returned an error. Status=403 Code=”AuthorizationFailed” Message=”The client ‘0a6fd422-1965-4ccb-9f41-b8a70ed23871’ with object id ‘0a6fd422-1965-4ccb-9f41-b8a70ed23871’ does not have authorization to perform action ‘Microsoft.Storage/storageAccounts/listKeys/action’ over scope ‘/subscriptions/5c1728b3-3e47-4c03-9bc8-a54abe9c334f/resourceGroups/devops-journey-rg/providers/Microsoft.Storage/storageAccounts/devopspraxstg’ or the scope is invalid. If access was recently granted, please refresh your credentials.”

    thanks for your help

  4. stuck with below error during terraform plan task
    /opt/hostedtoolcache/terraform/0.15.4/x64/terraform providers

    │ Error: No configuration files

    │ The directory /home/vsts/work/1/s contains no Terraform configuration
    │ files.

    /opt/hostedtoolcache/terraform/0.15.4/x64/terraform plan -input=false -var-file=./labs/2-AzureDevOps-Terraform-Pipeline/vars

    │ Error: Failed to read variables file

    │ Error while reading ./labs/2-AzureDevOps-Terraform-Pipeline/vars: read
    │ ./labs/2-AzureDevOps-Terraform-Pipeline/vars: is a directory.

    ##[error]Error: The process ‘/opt/hostedtoolcache/terraform/0.15.4/x64/terraform’ failed with exit code 1
    Finishing: plan

  5. I have a problem at pipeline, and I can’t go through it.
    ##[error]No hosted parallelism has been purchased or granted. To request a free parallelism grant, please fill out the following form https://aka.ms/azpipelines-parallelism-request
    Pool: Azure Pipelines
    Image: ubuntu-latest
    Job preparation parameters
    ContinueOnError: False
    TimeoutInMinutes: 60
    CancelTimeoutInMinutes: 5
    Expand:
    MaxConcurrency: 0
    ########## System Pipeline Decorator(s) ##########
    Begin evaluating template ‘system-pre-steps.yml’
    Evaluating: eq(‘true’, variables[‘system.debugContext’])
    Expanded: eq(‘true’, Null)
    Result: False
    Evaluating: resources[‘repositories’][‘self’]
    Expanded: Object
    Result: True
    Evaluating: not(containsValue(job[‘steps’][‘*’][‘task’][‘id’], ‘6d15af64-176c-496d-b583-fd2ae21d4df4’))
    Expanded: not(containsValue(Object, ‘6d15af64-176c-496d-b583-fd2ae21d4df4’))
    Result: True
    Evaluating: resources[‘repositories’][‘self’][‘checkoutOptions’]
    Result: Object
    Finished evaluating template ‘system-pre-steps.yml’
    ********************************************************************************
    Template and static variable resolution complete. Final runtime YAML document:
    steps:
    – task: 6d15af64-176c-496d-b583-fd2ae21d4df4@1
    inputs:
    repository: self
    MaxConcurrency: 0

Leave a Reply to Afzal Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s