Creating a new project in Azure DevOps with your desired process template is straightforward. However, it is only the start of the job for most administrators. They will commonly want to set up other configuration settings such as branch protection rules, default pipelines etc. before giving the team access to the project. All this administration can be very time consuming and of course prone to human error.
To make this process easier, quicker and more consistent I have developed a process to automated all of this work. It uses a mixture of the following:
A sample team project that contains a Git repo containing the base code I want in my new Team Project’s default Git repo. In my case this includes
- An empty Azure Resource Management (ARM) template
- A .NET Core Hello World console app with an associated .NET Core Unit Test project
- A YAML pipeline to build and test the above items, as well as generating release notes into the Team Project WIKI
- Create a new Team Project
- Import the sample project Git repo into the new Team Project
- Create a WIKI in the new Team Project
- Add a SonarQube/SonarCloud Service Endpoint
- Update the YAML file for the pipeline to point to the newly created project resources
- Update the branch protection rules
- Grant access privaledges as needed for service accounts
The script is far from perfect, it could do much more, but for me, it does the core requirements I need.
You could of course enhance it as required, removing features you don’t need and adding code to do jobs such as adding any standard Work Items you require at the start of a project. Or altering the contents of the sample repo to be cloned to better match your most common project needs.
You can find the PowerShell script in AzureDevOpsPowershell GitHub repo, hope you find it useful.