I am trying to deploy an azure function app using an ARM template; however, I am unable to hit the function endpoints after deployment. I believe the issue is related to my ARM template, but I'm not sure what is wrong. The template passes validation & deploys successfully. I can even hit the deployed function and see the generic home page every function gets by default. The issue is, I cannot hit any of the functions in it without getting a 404. The function app code I am trying to deploy is just a new function project with a single "test" (GET/POST) function inside it (all auto generated by vscode).
If I deploy the function app using vscode & let vscode create the function app, it works fine. This leads me to believe the function app code is correct. If I deploy to my existing function (created using the ARM template), it deploys successfully, but I cannot hit any of the functions in it, only the home page.
I have tried to strip this ARM template down to the bare bones hoping to solve the issue, but I am at a loss. Has anyone else had this issue before or have any recommendations? I've been digging through Azure docs for hours with no luck. Any advice/input would be greatly appreciated! :)
Here is the template:
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"env": {
"type": "string",
"allowedValues": [ "dev", "test", "prod" ],
"defaultValue": "dev"
},
"name": {
"type": "string",
"defaultValue": ""
}
},
"variables": {
"resourceGroupName": "[concat(parameters('env'),'-ms-',parameters('name'))]"
},
"resources": [
{
"type": "Microsoft.Resources/resourceGroups",
"apiVersion": "2020-10-01",
"location": "East US",
"name": "[variables('resourceGroupName')]"
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2020-10-01",
"name": "[concat(variables('resourceGroupName'),'_deployment')]",
"resourceGroup": "[variables('resourceGroupName')]",
"dependsOn": [
"[resourceId('Microsoft.Resources/resourceGroups',variables('resourceGroupName'))]"
],
"properties": {
"mode": "Incremental",
"expressionEvaluationOptions": {
"scope": "Inner"
},
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"variables": {
"storageName": "[concat('storage',uniqueString(resourceGroup().id))]",
//"insightsName": "[concat('insights',uniqueString(resourceGroup().id))]",
"functionAppName": "[concat('function',uniqueString(resourceGroup().id))]"
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2021-01-01",
"location": "[resourceGroup().location]",
"name": "[variables('storageName')]",
"kind": "StorageV2",
"sku": {
"name": "Standard_LRS"
}
},
// {
// "type": "Microsoft.Insights/components",
// "apiVersion": "2015-05-01",
// "location": "[resourceGroup().location]",
// "name": "[variables('insightsName')]",
// "kind": "web",
// "properties": {
// "Application_Type": "web"
// }
// },
{
"type": "Microsoft.Web/sites",
"apiVersion": "2018-11-01",
"location": "[resourceGroup().location]",
"name": "[variables('functionAppName')]",
"kind": "functionapp,linux",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts',variables('storageName'))]"
],
"properties": {
"siteConfig": {
"appSettings": [
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~3"
},
{
"name": "FUNCTIONS_WORKER_RUNTIME",
"value": "node"
},
{
"name": "AzureWebJobsStorage",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageName')), '2021-01-01').keys[0].value)]"
}
// {
// "name": "APPINSIGHTS_INSTRUMENTATIONKEY",
// "value": "[reference(variables('insightsName')).InstrumentationKey]"
// },
// {
// "name": "APPLICATIONINSIGHTS_CONNECTION_STRING",
// "value": "[reference(variables('insightsName')).ConnectionString]"
// }
]
// "use32BitWorkerProcess": false,
// "minTlsVersion": "1.2",
// "http20Enabled": true,
// "ftpsState": "Disabled"
},
// "httpsOnly": true,
"reserved": true
}
}
],
"outputs": {
"functionName": {
"type": "string",
"value": "[variables('functionAppName')]"
}
}
}
}
}
],
"outputs": {
"functionName": {
"type": "string",
"value": "[reference(concat(variables('resourceGroupName'),'_deployment')).outputs.functionName.value]"
}
}
}