Posts

Showing posts with the label Azure Repos

List of Repositories - Authorize Rest API calls using Job Access Token

Image
  Author: Akhil M Anil || DevOps Engineer Getting the complete list of Repository names  in Azure DevOps Project using REST Api and Publishing as a CSV file. In the last blog I have talked about Authorizing REST API call using Job Access Tokens. If missed, please find that blog here:  Job Access Tokens . In this blog we will use Job Access Token to Authorize Rest API call and retrieve the list of repositories.  Full code can be found in GitHub:  Repository-List Steps: Push the developed pipeline code  (azure-pipelines-repos.yml) and python code  (repos.py) to Azure Repos. We are using  Repositories - List - REST API  to fetch the repository list using python. Job Authorization Scope for Job Access token. In order to access repositories using system access token, we need to change our default job authorization scope. In my last blog I have already mentioned about Job Authorization Scopes, feel free to take a look.  To set job a...

Job Access Tokens || Authorize REST API calls to access resources in ADO using Job Access Tokens

Image
  Author: Akhil M Anil || DevOps Engineer For applications that interface with Azure DevOps Services, you must authenticate to gain access to resources like REST APIs. There are different ways to authenticate our applications with Azure DevOps Services. In this article we will use job access token/system access token (SYS_TOKEN) to authenticate into Azure DevOps. A job access token is a security token that is dynamically generated by Azure Pipelines for each job at run time. The agent on which the job is running uses the job access token in order to access these resources in Azure DevOps. It is fully possible to use System Access Tokens and eliminate the need for PATs in ADO pipeline for authorize the REST API calls to ADO. Furthermore, there is no need to save any credentials to files on disc and the System Access Tokens can be leveraged transiently as environment variables scoped to a specific job. The token's permissions are derived from job authorization scope the permis...

Authenticate to Azure DevOps using PAT token

Image
  Author: Akhil M Anil || DevOps Engineer For applications that interface with Azure DevOps Services, you must authenticate to gain access to resources like REST APIs. There are different ways to authenticate our applications with Azure DevOps Services. In this article we will use a personal access token (PAT) to authenticate into Azure DevOps. A personal access token contains your security credentials for Azure DevOps. A PAT identifies you, your accessible organizations, and scopes of access. As such, they're as critical as passwords. Since PAT is as identical as a user credential many organizations restrict its usage in Azure DevOps Api's instead promote the usage of any other authentication method or store the PAT token in Key-Vaults and use them. 1. Let's create a PAT token in ADO.  Sign into your organization From the home screen select the user settings and select Personal Access Token. Select +New Token. Give a name for the token, select the organization then set...

Getting the complete list of Repository names and details in Azure DevOps Project and Publishing as a CSV file using ADO Pipeline

Image
  Author: Akhil M Anil || DevOps Engineer Getting the complete list of Repository names  in Azure DevOps Project using REST Api and Publishing as a CSV file Representational State Transfer (REST) APIs are service endpoints that support sets of HTTP operations (methods), which provide create, retrieve, update, or delete access to the service's resources. This article covers creating a REST API call pipeline in Azure DevOps to access the Repos and retrieve the list of all Repositories created and publish the list as a csv file. Full code can be found in GitHub:  Azure-DevOps/Repos-List Nb: For authenticating to ADO, we are using PAT token. Ref:  Use personal access tokens - Azure DevOps | Microsoft Learn   Steps: Push the developed pipeline (azure-pipelines-repos.yml) code and python (repos.py) code to Azure Repos. If you have an existing PAT token use the PAT and make sure the PAT token has access to list the Repository list, if not create a PAT token and use th...