0
votes

I have a project with X number of azure functions. For load balancing and other issues I Need to deploy these azure functions across different resource groups.

Also I need to deploy only some functions on some resource groups.

Let's say I have project FunctionsTest with 5 azure functions (let's call them A, B, C, D, E)

I have also Resource group 1, 2, and 3.

I want to deploy Function A,B and C, on resource group 1,2,3. I want to deploy D only on resource group 2. I want to deploy E only on resource group 3 (so thet it will have all the 5 functions)

Result: Resource group 1-> Functions A,B,C

Resource group 2-> Functions A,B,C,D

Resource group 3-> Functions A,B,C,D,E

Function app name is not a problem the addres xxxx.azurefunctions.net is already unique because I have a Function App Service (where you deploy and manage functions) with an unique name for each of the resource group, so it would be just a matter of finding how to do this or create a publish profile on visual studio that does what I need.

Thank you

2
You mean all your functions are in the same azure function project ? You need to create multiple function apps to do this.Thomas
What exactly are you trying to accomplish? Seems you very much over thinking this. "Load Balancing" and Resource Groups aren't really related items. You need to look at the difference between Consumption Plan and App Service Plan, not Resource Groups.Johns-305

2 Answers

2
votes

You will need to create separate Function App projects. When you deploy a Function App project it will deploy all the Functions within that project into the same Function App. If you need multiple Apps with different Functions in them, then you need to create different Visual Studio Projects for each App.

1
votes

Posting this to help who comes here.

Solution 1: See Chris Pietschmann answer. That is the official way. At least as of today, unless you want to use complicated error-prone powershell ways.

Solution 2: Workaround Pick the class files of the azure functions you don't want to deploy and exclude them from the project. Deploy the project. Re-include them back.

I did the last one because the functions I am working on are part of the same logical block (they accomplish a task togheter) but for cost management and other technical reasons and because they are like 10 functions, I want them to be in a single project, not scattered on 10 different projects.