Accessing Azure DevOps Files via Power Automate

I had a scenario a while back where I was trying to access data from Azure DevOps. The catch was that I wanted to get access to some files to load as part of an environment setup in Azure DevOps. A function, oddly enough, that was not available via the Azure DevOps connector.

In order to accomplish this task, I had two options available to me: 1) Use the Azure DevOps HTTP Connector or 2) use the HTTP Connector.

Using the HTTP Connector

The process for accessing this data was pretty straightforward, where I copied the information from my AzureDevOps URL and then gave it a path to provide a list of files.

Note: If you are looking for a number of files to loop through, you will need “recursionLevel=Full” in this parameter.

The key part here is the authentication, where I provide a PAT (Personal Access Token) that I retrieved from AzureDevOps and configure as Basic authentication in order to retrieve the data. Usage of a PAT here does raise some concerns, as this is tied to your account, and when it expires, it’s not a good time.

As an additional aside, the data that I was retrieving from Azure DevOps I wanted to come through as the JSON it was being stored as, and to accomplish this, once retrieved (from a secondary call to Azure DevOps), I then had to encode it.

base64ToString(body('Get_Contents_of_all_Json_Data_Files')?['$content'])

The Azure DevOps HTTP Connector

The Azure DevOps HTTP Connector differs slightly in implementation: you specify the organization you are connecting to, and then you can provide some of the Base encoding that I mentioned above.

The Azure DevOps connection requires a service principal or app registration, which is better than generating Personal Access Tokens in Azure DevOps because they are not tied to your account.

Essentially, the Azure DevOps HTTP Connectors wrap some of the core functionality you would be implementing around your HTTP Code that will reduce some of the work you’d be doing, which is already there, making it more scalable in the long run.