Wouldn't it be great to know if you were going to run into policy or compliance issues before you've even merged your infrastructure code into the main branch? Troubleshooting deployment issues after a PR is completed and the code is merged can get messy. This repository highlights how ARM templates can be validated with Azure Policy as part of a GitHub Action.
The action can be found in this GitHub repository. In the future, this action could be published to the GitHub Marketplace but, we have referenced the repository directly for now. This is a proof of concept afterall.
The Check Policy
action will be triggered whenever a pull request is created.
The main branch has branch protection rule which requires the Check Policy
action to be successfully completed before a pull request can be merged.
If you're new to the template development, see:
Tags: Azure Policy, ARM templates