0
votes

The end game for what I want to do is have an ARM template that creates an Azure Function App, with 2 functions inside, that are fronted by API Management.

It looks like to do this in ARM Templates, I need to create the individual functions themselves in the template as opposed to simply creating the function app and then deploying my C# code (Which would typically then create the functions). This is because I need the functions to exist before creating the API Management resource in the template because otherwise I would have to go back and configure endpoints etc to point to my function app.

If any of this is wrong. Correct me.

It looks like I am able to create individual functions using ARM Templates. Indeed the documentation here supports that : https://docs.microsoft.com/en-us/azure/templates/microsoft.web/2018-11-01/sites/functions

The relevant snippet of my template where I am up to is :

{
    "type" : "Microsoft.Web/sites/functions", 
    "apiVersion" : "2018-11-01", 
    "name" : "[variables('functionsLoginName')]", 
    "properties" : {
        "config" : {
            "bindings" : [{
                "name" : "[variables('functionsLoginShortName')]", 
                "type" : "httpTrigger"
            }
            ]
        }   
    }
}

But the main issue is what else I can add to that config object. The documentation tells me it's a config object... But not what that object contains.

enter image description here

I'm finding blog posts that have individual snippets of what could go there, but I'm unable to find the official documentation with the full JSON spec that I can refer back to.

1
There are a lot of parameters to set. Have you tried creating the function app manually and export the template from portal ? it would be the easier approach. There are also existing template you can use: github.com/Azure/azure-quickstart-templates/tree/master/…. After for the API management part, how do you plan to create your api, using Open API specifications file ?Thomas
I have. And it only exports the base function app and not the functions themselves. The templates do get us half way there but... Its bonkers that there is no documentation.MindingData
How are you creating your function ? using the portal ? from visual studio ? I mean there are hundreds of rticle on how to create and function app using CI/CD toolsThomas
I want to create the function from an ARM template, hence the question. There may be "hundreds of articles" on how to create a function using CI/CD tools. But in my case, where I want to create it from an ARM template, the documentation looks incomplete.MindingData
@MindingData, did you figure out how to deploy the actual functions within a Function App template? I'm trying to do the same thing. Looks like others are using the arm template to deploy only the function app, then use CLI commands to deploy the actual functions themselves within the pipeline.duyn9uyen

1 Answers

0
votes

@MindingData - These docs are auto-generated using Swagger files and more often than not, dynamic properties like config are missing from these documents.

To get started, you can use the below azuredeploy.json as an example:

https://github.com/Azure/azure-quickstart-templates/blob/master/201-logic-app-transform-function/azuredeploy.json

Another way you can deploy a function using ARM template is by using ZIP deploy: https://stackoverflow.com/a/53057357/10571855

FunctionWebDeploy.json

Hope this helps!