3 min read
Saving runtime variables to Azure DevOps Variable Groups
We use ARM outputs quite extensively in our Azure DevOps pipelines. At times you may need to get outputs from previous steps and store them as...
2 min read
Alexandre Verkinderen : Dec 7, 2023 9:32:00 PM
I like my Azure DevOps branches to be well structured and well named.
When we create a new ARM template a new feature branch is created based on the name of the template. This branch is short lived, typically only a few days and max 2 weeks. Once the development of the template is done, a pull request is created, the branch gets merged if all tests are passed and the branch gets deleted. We also have branches that will be created in the rare case a bug has been discovered in one of our ARM templates. These branches are even more short lived, typically only a few hours to maximum a few days.
We use the following naming convention for our branches:
When working with lots of different people in the same AzDo project the number of branches can increase exponentially and it can quickly become a mess. Hierarchical branch folders is an easy solution to keep your branches clean and well structured. In Azure DevOps when you create a new folder with /
it will automatically create that new branch under a folder.
The following standards have been defined in our AzDo environment:
To be able to enforce folders in Azure DevOps we will need to use Team Foundation version control command (tf.exe
). You can find tf.exe if you have installed Visual Studio in the following location: C:\Program Files (x86)\Microsoft Visual Studio\2019\TeamExplorer\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer
. You will also need the AzDo organization name, the project name, the repository name and full permissions to change branch permissions. So in my case it is the following:
Open the Developer Command Prompt, under Start > Visual Studio > Developer Command Prompt and go to the location of tf.exe.
First, let’s block the creation of new branches under the root
tf git permission /deny:CreateBranch /group:[Todo]\Contributors /collection:https://dev.azure.com/azurelns/ /teamproject:Todo /repository:Todo
Then allow contributors to create new branches under the Features folder
tf git permission /allow:CreateBranch /group:[Todo]\Contributors /collection:https://dev.azure.com/azurelns/ /teamproject:Todo /repository:Todo /branch:Feature
and the bugs folder
tf git permission /allow:CreateBranch /group:[Todo]\Contributors /collection:https://dev.azure.com/azurelns/ /teamproject:Todo /repository:Todo /branch:Bugs
Finally, allow administrators to create a branch called master and dev (in case it ever gets deleted accidentally) :man_shrugging: .
tf git permission /allow:CreateBranch /group:"[Todo]\Project Administrators" /collection:https://dev.azure.com/azurelns/ /teamproject:Todo /repository:Todo /branch:master
tf git permission /allow:CreateBranch /group:"[Todo]\Project Administrators" /collection:https://dev.azure.com/azurelns/ /teamproject:Todo /repository:Todo /branch:dev
Now when I want to create a new branch directly under the root it will blocked as I’m not following the correct naming convention.
To create this branch I would need to place it in a folder like this: “Feature/testbranch”
When working with multiple people on a project it is important to define some kind of hierarchical branch structure. The Team Foundation version control command lets you enforce that structure.
Hope this helps, Alex
3 min read
We use ARM outputs quite extensively in our Azure DevOps pipelines. At times you may need to get outputs from previous steps and store them as...
3 min read
Bernie White has a Powershell Module (PSDocs) that can generate mark down files (*.md) and Stefan Stranger’s blog post shows us how to upload these...
3 min read
Hi all, This blog post will cover how to transform data with Azure Machine Learning Workbench. One of the most important aspects in any Machine...