2 minutes
(Azure DevOps) Committing and Pushing to Azure Git Repository from Azure Pipeline
Azure Git Repository Workflow
In a unique use-case scenario, we encountered the need to dynamically generate Terraform HCL files during Azure DevOps pipeline operations and subsequently commit and push these files back to Azure Git Repos. While this isnât a conventional operation, we successfully achieved this using the pipeline configuration outlined below.
Assuming your pipeline has completed its tasks, including the generation or modification of files, the next step is to commit and push these changes to the Git repository. This action will inevitably trigger another pipeline, with the second pipeline focused on deployment rather than the initial Terraform file generation.
While the commands are self-explanatory, itâs crucial to highlight the authentication aspect, which is facilitated through SSH keys stored in Azure Pipelinesâ Variable Group. Additionally, you need to place your public SSH keys in your profile. For detailed authentication setup, refer to Microsoftâs guide on SSH key authentication.