Mark Juniper

Power Platform | MS365 | Azure


Automatically populating the Git user.name and user.email when committing via Azure DevOps Pipelines

Published March 12, 2024

I’ve been reviewing our Azure DevOps pipeline setup, and noticed that each pipeline has its commit hardcoded to whichever Developer created it.

This is one of those things that’s probably dead obvious if you work with Azure DevOps every day. But for me as an occasional user working with classic pipelines it took time to work out.

Microsoft’s recommended method of having an Export/Commit pipeline for Power Platform projects ends with a commit step. An inline PowerShell script commits your exported and unpacked Solution to the repository.

To make the commit message use the details of whichever User runs the pipeline, do the following:

git config user.email "$(Build.RequestedForEmail)"
git config user.name "$(Build.RequestedFor)"

The expressions between $() are variables native to ADO. wrapping these in quotes passes a string representation of the User information to the Git message.

This commits as whoever runs the pipeline.