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
- Initial Setup starts you off with setting up:
- Azure DevOps Setup
- Azure DevOps Organisation Setup
- Azure DevOps Project Creation
- Azure Service Principal Creation
- Azure Terraform setup
- Create Blob Storage location for Terraform State file
- Create Azure AD Group for AKS Admins
- Create Azure AD AKS Admin Group
- Azure DevOps Setup
- 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.
- Pipeline setup
- Setup Azure DevOps Pipeline
- Pipeline setup
- Deploy Application to Azure Container Registry Deploy sample Application to Container Registry.
- Deploy Application to Azure Container Registry
- Build the Docker Image Locally
- Run The Docker Image Locally
- Deploy sample Application to Container Registry
- Deploy Application to Azure Container Registry
- Deploy Application to Azure Kubernetes Cluster
- Add AKS ACR Role assignment
- Terraform to add role assignment for AKS managed identity to access the deployed ACR
- Add Application Insights to Terraform
- Application Insights will be used to monitor the application once deployed!
- Add Azure Key Vault to Terraform
- Azure Key Vault will be used to store secrets used within your Azure DevOps Variable Group.
- Update Pipeline to Deploy Application to AKS
- Update Pipeline to Deploy asp Application to AKS
- Add AKS ACR Role assignment
- Introduce CI/CD
- Introducing CI/CD to your pipeline
- Begin CI/CD with Pipeline Trigger for automatic pipeline runs
- Automated deployment of your AKS Application
- In previous labs; the application was initially manually setup for its build tag. In CI/CD, this would be automated and the Application on the AKS cluster would update each time the pipeline has been ran.
- Introducing CI/CD to your pipeline
- Testing your deployed Azure Infrastructure
- Testing Infrastructure using Inspec
- Using Inspec-Azure to test your Azure Resources
- Inspec Testing using Azure DevOps Pipeline
- Run Inspec-Tests using Azure DevOps
- View Inspec reports in Azure DevOps
- Testing Infrastructure using Inspec
- Monitoring and Alerting
- Azure Application Insights
- Using Application Insights to view telemetry data!
- Azure Application Insights Availability Tests
- Configure availability test using Application Insights
- Log Analytics Container Insights
- Reviewing Log Analytics Container Insights
- Azure Application Insights
CI/CD
You will learn how to setup and configure a pipeline that involves CI/CD

- Developer changes application source code.
- Application is committed to the source code repository in Azure Repos.
- Continuous integration triggers application build
- Continuous deployment within Azure Pipelines triggers an automated deployment with environment-specific configuration values.
- Updated Application is deployed to environment specific Kubernetes cluster
- Application Insights collects and analyzes health, performance, and usage data.
- 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!
Awsome
Thank you, glad you enjoyed it!
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
Hi Jason,
As discussed on LinkedIn, you need to have terraform folder in root of repo
Thanks, Thomas! That worked perfectly.
Thank you, let me know how you get on with the further labs!
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
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
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
Hi,
See step 7 – https://github.com/thomast1906/DevOps-Journey-Using-Azure-DevOps/blob/4354662443a1a659c9b84ad160cee157bcef00b8/labs/1-Initial-Setup/1-Azure-DevOps-Setup.md
“All Service Principal role assignment to subscription, in this lab I will be giving the Service Principal contributor access to the subscription”
Thanks
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
Châpeau!
You’re the Best!
Thanks for sharing!
Thank you so much for the comment, glad you enjoyed it!
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
Please fill out form as mentioned
Thanks
Thomas
Tried to follow the blog but not able to finish, Instructions are not clear enough.
Stuck with https://github.com/thomast1906/DevOps-Journey-Using-Azure-DevOps/blob/main/labs/2-AzureDevOps-Terraform-Pipeline/1-Setup-AzureDevOps-Pipeline.md
Not able to set up a repository and terraform extension
Hi Navneet,
Not sure what you mean?
.all steps are documented
Thanks
I had the same issue. I filled out the form and Microsoft resolved it in a day or two:https://aka.ms/azpipelines-parallelism-request
Yup, if error appears fill out as mentioned
Thanks
Thomas