Saturday, February 29, 2020

Using System OAuth Token in the Agent Phase of the Azure DevOps Build Pipeline to Access Azure DevOps REST API

Azure DevOps REST API endpoints are service endpoints that allows to create,update,retrieve and delete the Azure DevOps service's resources. While executing these REST API commands it is required to use Authentication mechanisms in order for the API it to perform authorized operations. This post explains how to execute API commands without providing authentication as a Personal Access Token (PAT) in the script execution in a build job.

There is a configuration in the Azure DevOps build pipeline which enable the scripts and other process launched by tasks to access the OAuth token through the SYSTEM.ACCESS.TOKEN variable. When access to the system access token is enabled it is possible to use $env:SYSTEM_ACCESSTOKEN environment variable in the task scripts, that you are executing in a build pipeline job.

Wednesday, February 19, 2020

Resolving Queue Creation Script Failures Due to Delay in Applying Default Action of a Azure Storage Account in IaC

This post discusses an issue faced, while trying to allow in the default action of a storage account,  running PowerShell based Azure CLI, Infrastructure as code.

Issue : Requirement is to create a new azure storage queue using the PowerShell script in an existing storage account which is attached to a vnet and have access restrictions applied. Hence, the script needs to remove the restrictions to storage by setting Defualt Action to allow and then  create new storage queue. Once the new queue added to the storage, restrict the storage account access again. However, the time delay to apply the removal of restriction sometimes create an a hoc issue as the next step to create the queue fails with, network access error.