2
votes

I'm working on an API in core3.1. We have a build pipeline that builds and unit tests any change for any branch. And release pipelines for development and master branches. These deploy to designated app services in Azure.

Now we would like a release pipeline for feature branches. So what we want is a pipeline that can dynamically created app-services per feature branch and deploy to that app service. And preferably dynamically delete the app-service when the branch is deleted.

Just to clarify, the proces how we would like it:

a developer creates feature branch and pushes it > 
the build pipeline builds it > 
an app service gets created automatically > 
stuff gets deployed to that app service > 
developers work on the branch and changes get build and deployed to the app service like normal > 
at some later point a developer deletes branch > 
app service gets deleted automaticcaly

Is there any way to accomplish this? Maybe there is a standard way? Feature branches are located in a subfolder, e.g. "feat/feature-branch-name". I'm fairly new to Azure and DevOps. Any help is appriciated. Thanks in advance.

1
How about an ARM template with necessary parameters that you get from e.g. the branch name? This would only take care of creation though, not deletion.juunas
I will look into it. I should clarify though I'm fairly new to Azure DevOps.Martijn
I looked into ARM templates and it's kind of a lot to dive into with just hopes of it giving me a solution. Does anybody have a more concrete idea to help me? I cannot be the first person who wants to do have such a solution.Martijn
True.. It might be a bit over-kill for that. A script with az CLI or Azure PowerShell could do it easier. Still doesn't address the removing part though. I suppose some kind of scheduled job running somewhere could clean up those unused apps?juunas
removing is not a must have.Martijn

1 Answers

2
votes

You should follow the practice of Infrastructure as Code (IaC) and use ARM templates in your pipeline to create/update/delete your Azure resources. You can also use the built-in tasks available in Azure DevOps to deploy your ARM templates.