Showing posts with label DevOps. Show all posts
Showing posts with label DevOps. Show all posts

Saturday, 31 August 2024

Automate Validation of Nginx Ingress Controller Setup in AKS with an Azure Pipeline Task

 We have dicussed "Deploy Nginx Ingress Conroller with Private IP (Limited Access to vNET) to AKS with Terraform, Helm and Azure DevOps Pipelines" in the previous post. Once deployed it takes few seconds to fewminutes to get the Nginx ingress controller with private IP ready in AKS. Let's explore how to automate AKS Nginx ingress controller validation inAzure pipelines in this post.

Saturday, 10 August 2024

Copy Environment Across Team Projects in Azure DevOps

 We have dicussed how to "Copy Variable Groups Across Team Projects in Azure DevOps" in a previous post. In similar way we can use a scrip with Azure DevOps REST API to copy environment defined in Azure DevOps across team projects.

Friday, 2 August 2024

Copy Variable Groups Across Team Projects in Azure DevOps

 You can easily clone a variabe group in Azure DevOps within a given team project. However, There is no straight forward way to copy a variable group from a team project to another team project. We can write a scrpt using Azure DevOps REST API to achive the requirement.

Friday, 13 October 2023

Conditionally Passing Different Values to Template Parameters in Azure DevOps Pipelines

Parameters Azure pipeline template helps to achieve dynamic behaviours in pipeline templates. Passing different values for template parameters based on conditions, via a single usage of teplate will help to reduce duplication of usage of template in the pipeline. Let's look at how to conditionally pass different values to template paramters with a practical example.

The expected behavoir

Let's assume there are three stages in the pipeline.

  • Unit test stage - to build and unit test
  • Build and push Docker image stage
  • Deploy app stage

If we are in develop branch (refs/heads/develop) we want to run unit tests, build dcoker image and depending on both stages want to run a deploy.

Monday, 14 August 2023

Importing a Git Repo with LFS (Large Files) to Azure GIt Repos

 Importing a git repo to Azure DevOps Git is straight forward using the Azure DevOps portal. However, if the importing repo has large files with git lfs then the cloning of the repo after import fails due to the large files are not imported. Let's see how to get the large files fixed for the imported repo.

Friday, 30 September 2022

Replace String in Variable in Azure DevOps YAML Pipelines

In  Azure DevOps YAML pipelines there are several functions available for you to use. replace is such a useful function, which you can use to replace string segements within a string. Let's look at how we can use replace function to replace contents of a variable. 

Use case would be: For example you have a variable value for your customer api name as cutomer-api.  You may need to use it and generate customer_api value for another variable which you want to use in a namig of resouce, for consitency purpose with _ in naming instead of -.

Friday, 29 October 2021

Getting Started with Power Automate for Azure DevOps - Signing Up

 Autmation of repetitive tasks is a norm in modern software practices. Power Automate helps us to streamline the repetitive tasks and focus on other important aspects of work. Azure DevOps connectors for Power Automate helps automate actions in Azure DevOps in scenarios such as creating of Bug work item based on an email received with word Bug in the subject, or allowing team to crease a work item in Azure DevOps via MS Teams etc. We can explore these possibilities later on. Let's try o get started by signing up with Power Automate as the first step.

Tuesday, 28 September 2021

Resolving "There was a failure in sending the provision message: Unexpected response code from remote provider InternalServerError" in Azure DevOps Build Referring ACR

 Azure DevOps builds using ACR to push docker image may encounter error "##[warning]There was a failure in sending the provision message: Unexpected response code from remote provider InternalServerError" and would not be able to proceed to starting build job. Let's find the quick fix for it.

Saturday, 7 August 2021

Role Assignment with Azure Bicep

Assigning roles in Azure resource is required step in infrastructure deployments. Azure Bicep supports assigning roles to Azure resources 'Microsoft.Authorization/roleAssignments' resource template. Let's take an example scenario to identify how to setup role assignment.

Friday, 30 July 2021

Passing Array Parameter to Bicep Scrip via Azure DevOps Pipeline

 Bicep infrastructure as code allows us to pass array parameters and write loop structure of script to deploy multiple resources to Azure. we can define json array as parameter value in an Azure DevOps variable to pass it as an array parameter to Bicep using a pipeline. However, it would be more appropriate to define varible values in much simpler way such as specifying ; separated value set which can be converted into a json string as in Azure pipeline before passing it to Bicep script. An example would be list of database names to create in the same Azure SQL elastic pool.

Friday, 25 June 2021

Azure Resources with Bicep Using Azure Pipelines

 Bicep is the latest Azure infrastructure as code (IaC) language introduced by Microsoft. We have discussed about getting  started with Bicep in the post "Azure Infrastructure as Code (IaC) with Bicep - Getting Started with Development".  Let's look at how to implement an Azure pipeline to deploy infrastructure to Azure with Bicep in this post.

Saturday, 19 June 2021

Passing Output Parameters from Bicep Modules

 We have discussed about deploying resources to a resource group using Azure Bicep in the post "Azure Infrastructure as Code (IaC) with Bicep - Creating Resources in Resource Group". If we are referring a resource created via a module in another module, we might have to pass identification of such resources as output parameters from a module. Let's learn how to pass output parameters in Bicep modules and use them in other resources in this post.

Saturday, 12 June 2021

Deploy AKS and ACR with GitHub Actions

 There are so many ways to write infrastructure as code such as using Terraform or Bicep for Azure. Azure CLI is a fast way to deploy infrastructure with PowerShell scripting to Azure. Deploying infrastructure in Azure with utilizing pipeline which is running infrastructure as code is useful to achieve fully automated deployments. Let's try to combine Azure CLI and GitHub Actions to deploy an AKS (Azure Kubernetes Services) with Azure container registry (ACR) association to achieve deployment automation of AKS.

Friday, 30 April 2021

Get Policy Availability in BitBucket Repo to Have a Build (Azure DevOps Build etc.) Validating a Pull Request

 You can setup Build pipelines in BitBucket itself or even Azure DevOps builds to validate an incoming pull request to a stable branch such as master/main. You might want to setup some KPIs to validate availability of such build for PR validation. For such requirements you may have to obtain data from BitBucket API to check if a build validation policy exists for the stable branches in your repos. Let's see how we can get such data from BitBucket APIs.

Monday, 26 April 2021

Pass Map Type Parameters to Terraform via Azure Pipelines

Terraform based resource deployment to Azure is a great way to implement infrastructure as code. The map type in variables support implementing loop-based resource deployment specifications in terraform. It is important to understand passing such variable as parameter in command line to implement pipelines.

Wednesday, 18 November 2020

Enhanced YAML Conversion for Azure DevOps Classic Build Pipelines

Azure DevOps YAML pipelines is the way to implement pipeline as code and version control the pipelines alongside your application code. However, among Azure DevOps users classic build pipelines are still popular due to its simple, visual ability to implement and understand faster etc. Additionally, classic pipeline agent job or individual step could be converted to YAML by using “View YAML” option available in each step/task as well as for a given agent phase. With a recent update to Azure DevOps new feature has been added to enable exporting entire classic build pipeline as YAML replacing the “View YAML” feature. This is a great improvement feature added to Azure DevOps as “View YAML” feature was only able to consider information in web UI when generating YAML out of classic pipeline, which at times generated incorrect YAML. With the new export YAML feature, now you can derive a reliable YAML implementation of a given classic pipeline. This would help people to implement pipeline quickly using classic pipeline UI and convert and obtain a YAML, which would help pipeline as code adoption easier. Let’s look at how we can use this new export to YAML feature.

Friday, 2 October 2020

Trigger Deployment YAML Pipeline Once YAML Build Completed

Now it is possible to implement multi stage pipelines with YAML facilitating the implementation of deployment pipelines as well with YAML instead of classic release pipelines in Azure DevOps. However, having build and deployment steps all together in a single pipeline script is not ideal as it looks bit not a nice implementation from my point of view. With the possibility of triggering another YAML pipeline based on completion of another YAML pipeline, it is possible to separate the Build and Deployment concerns into two different YAML scripts implementing two different pipelines. Let’s have a quick look at how we can trigger a YAML deployment pipeline based on another YAML build pipeline.

Friday, 25 September 2020

Set Work Item State on Pull Request Completion

Associated work items help to identify what is completed in a given pull request. If required while completing a pull request you could, set the associated work item to be moved to completed state. With the introduction of new feature, which we are discussing in this post, you would be able to set the work item state (regardless of it is associated work item or not for the pull request) to desired closed, in progress or resolved states based on description specification.

Saturday, 19 September 2020

Azure Terraform Infra as Code Deployment via Custom PowerShell with Azure DevOps Pipelines – Part 2 – Execute Plan with Approval

In the previous post “Azure Terraform Infra as Code Deployment via Custom PowerShell with Azure DevOps Pipelines – Part 1 – Create Plan” we have discussed how to generate a terraform plan targeting Azure Infrastructure deployment and upload it to an Azure Git repo. The solution is implemented instead of using terraform task for Azure DevOps, which is available with Microsoft DevLabs extension due to it is having a prerequisite of Azure resource group, storage etc. as described in the post “Why Azure DevOps Terraform Extension Task by Microsoft DevLabs to Deploy Infra to Azure Does Not Work for Me”. As the second part of previous post, let’s explore the steps require to approve the terraform plan and get the plan executed with Azure DevOps pipeline relying on a state kept in Azure Git repo instead of a storage blob, which is eliminating the need of having manually created Azure resources.

Friday, 11 September 2020

Azure Terraform Infra as Code Deployment via Custom PowerShell with Azure DevOps Pipelines – Part 1 – Create Plan

As described in the post “Why Azure DevOps Terraform Extension Task by Microsoft DevLabs to Deploy Infra to Azure Does Not Work for Me”, the Microsoft DevLabs task to plan and apply terraform infrastructure as code, is demanding to store state in Azure blob storage, which requires to create Azure resources manually as prerequisite of using the task. In this post let us look at a custom implementation of terraform plan and apply task utilizing PowerShell, while storing terraform state and plans in Azure Git repo and have an approval in between the plan and apply steps, to enhance the deployment workflow.

Popular Posts