I have an azure function that works when manually deployed via visual studio. I then exported the ARM template from Azure portal and used this in a DevOps release pipeline. The release pipeline succeeds after creating storage a hosting plan the function app and deploying the code to the function app.
When trying to access the function app however it throws a 404 not found error. I've tried in postman and in the "code + test" section of the azure portal, but I get the same 404 error.
I assume the ARM template exported from azure portal is incorrect somehow but I cannot see how, as it deploys successfully.
Has anyone experienced this issue?
In case it is useful, below is the ARM template, almost as it was exported from the portal. I have changed function name and urls just to prevent any potential attacks.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"sites_myFuncName_name": {
"defaultValue": "myFuncName",
"type": "String"
},
"serverfarms_FuncsPlan_externalid": {
"defaultValue": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Web/serverfarms/hostingPlanName",
"type": "String"
}
},
"variables": {},
"resources": [
{
"type": "Microsoft.Web/sites",
"apiVersion": "2022-03-01",
"name": "[parameters('sites_myFuncName_name')]",
"location": "North Europe",
"kind": "functionapp",
"properties": {
"enabled": true,
"hostNameSslStates": [
{
"name": "myFuncName.azurewebsites.net",
"sslState": "Disabled",
"hostType": "Standard"
},
{
"name": "myFuncName.scm.azurewebsites.net",
"sslState": "Disabled",
"hostType": "Repository"
}
],
"serverFarmId": "[parameters('serverfarms_FuncsPlan_externalid')]",
"reserved": false,
"isXenon": false,
"hyperV": false,
"vnetRouteAllEnabled": false,
"vnetImagePullEnabled": false,
"vnetContentShareEnabled": false,
"siteConfig": {
"numberOfWorkers": 1,
"acrUseManagedIdentityCreds": false,
"alwaysOn": false,
"http20Enabled": false,
"functionAppScaleLimit": 200,
"minimumElasticInstanceCount": 0
},
"scmSiteAlsoStopped": false,
"clientAffinityEnabled": false,
"clientCertEnabled": false,
"clientCertMode": "Required",
"hostNamesDisabled": false,
"customDomainVerificationId": "XXXXX",
"containerSize": 1536,
"dailyMemoryTimeQuota": 0,
"httpsOnly": true,
"redundancyMode": "None",
"storageAccountRequired": false,
"keyVaultReferenceIdentity": "SystemAssigned"
}
},
{
"type": "Microsoft.Web/sites/basicPublishingCredentialsPolicies",
"apiVersion": "2022-03-01",
"name": "[concat(parameters('sites_myFuncName_name'), '/ftp')]",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('sites_myFuncName_name'))]"
],
"properties": {
"allow": true
}
},
{
"type": "Microsoft.Web/sites/basicPublishingCredentialsPolicies",
"apiVersion": "2022-03-01",
"name": "[concat(parameters('sites_myFuncName_name'), '/scm')]",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('sites_myFuncName_name'))]"
],
"properties": {
"allow": true
}
},
{
"type": "Microsoft.Web/sites/config",
"apiVersion": "2022-03-01",
"name": "[concat(parameters('sites_myFuncName_name'), '/web')]",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('sites_myFuncName_name'))]"
],
"properties": {
"numberOfWorkers": 1,
"defaultDocuments": [
"Default.htm",
"Default.html",
"Default.asp",
"index.htm",
"index.html",
"iisstart.htm",
"default.aspx",
"index.php"
],
"netFrameworkVersion": "v6.0",
"requestTracingEnabled": false,
"remoteDebuggingEnabled": false,
"remoteDebuggingVersion": "VS2019",
"httpLoggingEnabled": false,
"acrUseManagedIdentityCreds": false,
"logsDirectorySizeLimit": 35,
"detailedErrorLoggingEnabled": false,
"publishingUsername": "$myFuncName",
"scmType": "VSTSRM",
"use32BitWorkerProcess": true,
"webSocketsEnabled": false,
"alwaysOn": false,
"managedPipelineMode": "Integrated",
"virtualApplications": [
{
"virtualPath": "/",
"physicalPath": "site\\wwwroot",
"preloadEnabled": false
}
],
"loadBalancing": "LeastRequests",
"experiments": {
"rampUpRules": []
},
"autoHealEnabled": false,
"vnetRouteAllEnabled": false,
"vnetPrivatePortsCount": 0,
"localMySqlEnabled": false,
"ipSecurityRestrictions": [
{
"ipAddress": "Any",
"action": "Allow",
"priority": 2147483647,
"name": "Allow all",
"description": "Allow all access"
}
],
"scmIpSecurityRestrictions": [
{
"ipAddress": "Any",
"action": "Allow",
"priority": 2147483647,
"name": "Allow all",
"description": "Allow all access"
}
],
"scmIpSecurityRestrictionsUseMain": false,
"http20Enabled": false,
"minTlsVersion": "1.2",
"scmMinTlsVersion": "1.2",
"ftpsState": "FtpsOnly",
"preWarmedInstanceCount": 0,
"functionAppScaleLimit": 200,
"functionsRuntimeScaleMonitoringEnabled": false,
"minimumElasticInstanceCount": 0,
"azureStorageAccounts": {}
}
},
{
"type": "Microsoft.Web/sites/functions",
"apiVersion": "2022-03-01",
"name": "[concat(parameters('sites_myFuncName_name'), '/FuncName')]",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('sites_myFuncName_name'))]"
],
"properties": {
"script_root_path_href": "https://myFuncName.scm.azurewebsites.net/api/vfs/site/wwwroot/FuncName/",
"script_href": "https://myFuncName.scm.azurewebsites.net/api/vfs/site/wwwroot/bin/MyFuncName.dll",
"config_href": "https://myFuncName.scm.azurewebsites.net/api/vfs/site/wwwroot/FuncName/function.json",
"test_data_href": "https://myFuncName.scm.azurewebsites.net/api/vfs/data/Functions/sampledata/FuncName.dat",
"href": "https://myFuncName.scm.azurewebsites.net/api/functions/FuncName",
"config": {},
"invoke_url_template": "https://myFuncName.azurewebsites.net/api/FuncName",
"language": "DotNetAssembly",
"isDisabled": false
}
},
{
"type": "Microsoft.Web/sites/hostNameBindings",
"apiVersion": "2022-03-01",
"name": "[concat(parameters('sites_myFuncName_name'), '/', parameters('sites_myFuncName_name'), '.azurewebsites.net')]",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('sites_myFuncName_name'))]"
],
"properties": {
"siteName": "myFuncName",
"hostNameType": "Verified"
}
}
]
}