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.

As the first step you need to have a App Password (token) created for you in BitBucket to enable you to access APIs. You can do this in your account settings App Passwords section. You have to allow Admin access to reports to obtain the necessary data.

You can use this information and query for repositories in your BitBucket as follows. Below sample call is from postman but you can use any scripting language like PowerShell or try to utilize Power BI to call the REST API to obtain data and make it more visual.{workspacename}

Once you have the repository names you would be able to get the branch restrictions applied in each repo as follows. From the pattern you can identify the branches where the restrictions are applied.{workspacename}/{reponame}/branch-restrictions

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.

Monday, 19 April 2021

Automated Install of Docker Desktop with WSL2 on Windows 10

In windows 10 you can now setup Docker Desktop with Linux container, without using a virtual machine for Linux, by using Windows Subsystem for Linux (WSL). Remembering all manual steps for doing this is bit cumbersome, and therefore let’s look at how we can use PowerShell to automate the task of installing Docker Desktop with WSL version 2, on Windows 10.

Thursday, 18 March 2021

Deploying Azure Resource Group with Ansible Play Book Using Custom Ubuntu 18.04 VM

In a previous post we have discussed how to setup Ansible on Azure Ubuntu 18.04 VM. We can start using Ansible and execute play books to deploy Infrastructure on Azure cloud. Let’s look at how we can get started with deploying resources to Azure using an Ansible playbook, on the VM we created with Ansible as explained in the post “Install Ansible to Use Python3 on Azure Ubuntu 18.04 VM”.

Friday, 5 March 2021

Open SSH Connection in VS Code to Azure Ubuntu VM to Perform Remote Development

VS Code is a useful development tool which can be used on any platform to develop code in any language of your preference. In an Azure Ubuntu VM without setting up the desktop remote access, you may want to perform development work and may want to perform debugging activities, as you are doing with local files in a Linux environment. You can use ssh extension for VS Code and create ssh connection to a VM in Azure or anywhere over ssh and work connected to the remote Linux, MacOS or Windows machines via VS Code. Let’s look at steps to connect to a Ubuntu VM on Azure using a VS Code in Windows 10 local machine.

Friday, 26 February 2021

Install Ansible to Use Python3 on Azure Ubuntu 18.04 VM

Ansible is an open-source configuration and infrastructure management tool providing capability to implement infrastructure as code (IaC). Especially in Linux based implementations ansible is used heavily, however, it can support automation on Windows platform as well. Let’s learn some Linux IaC with ansible in the coming posts and in this post, lets try to setup an ansible installation on a Ubuntu 18.04 VM with python3 support, in Azure. Setting up user for ansible in the VM was explained in previous post “Create New Linux Admin User in Azure Ubuntu VM”.

Thursday, 18 February 2021

Create New Linux Admin User in Azure Ubuntu VM

We can setup Linux VMs in Azure for various reasons. Maybe it is for setting up a Jenkins or Ansible server. If we are setting up Ansible on a Linux VM in Azure it is recommended to use a separate user with Admin permissions, instead of the default user who has the root access as well. This is beneficial as in case we need to reset access for the default user, we can do so without harming anything setup for Ansible. In this post let us look at steps to add an additional admin user to Ubuntu Linux VM in Azure and how we can enable ssh to the VM with that user.

Saturday, 13 February 2021

Resolving 409 Access Denied in Azure Kudu and App Service Editor

Sometimes you may need to edit files especially the web.config or appsettings.json files after deploying your application to Azure App Service via Kudu or using App Service Editor to change the setting for diagnostic purposes etc. For example, may be you want to enable logs by setting stdoutLogEnabled to true. However, if your application is deployed to Azure App Service via Azure DevOps pipelines’ Azure App Service deployment task, you may run into 409 Access Denied error. Let’s understand why the error occurs and how we can enable editing the files, in your deployed Azure App Service application/Function apps via Kudu or using App Service Editor.

Popular Posts