Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ARM模板更新覆盖Azure函数中的某些内容以导致错误;函数运行时无法启动";_Azure_Azure Functions_Arm Template_Azureportal - Fatal编程技术网

ARM模板更新覆盖Azure函数中的某些内容以导致错误;函数运行时无法启动";

ARM模板更新覆盖Azure函数中的某些内容以导致错误;函数运行时无法启动";,azure,azure-functions,arm-template,azureportal,Azure,Azure Functions,Arm Template,Azureportal,如果我通过Azure门户创建dotnet C#Azure功能web应用程序,我可以(zip)发布我的功能,并且所有功能都正常工作。如果我导航到门户中的函数,我可以看到为我创建的function.json,并且一切运行正常 然后,根据我们的基础架构即代码原则,作为Azure Dev Ops中部署管道的一部分,我们执行一个ARM模板来更新功能应用程序,其中包含我们从门户中的功能应用程序复制的所有设置 在运行此模板后,当我们导航到门户中的函数时,我们会得到: Error: The function

如果我通过Azure门户创建dotnet C#Azure功能web应用程序,我可以(zip)发布我的功能,并且所有功能都正常工作。如果我导航到门户中的函数,我可以看到为我创建的function.json,并且一切运行正常

然后,根据我们的基础架构即代码原则,作为Azure Dev Ops中部署管道的一部分,我们执行一个ARM模板来更新功能应用程序,其中包含我们从门户中的功能应用程序复制的所有设置

在运行此模板后,当我们导航到门户中的函数时,我们会得到:

Error:

The function runtime is unable to start.
Session Id: a3dd6ec59c9a459d947ef1ffbb9bf00b

Timestamp: 2020-01-04T23:31:08.741Z
我们没有看到Function.json但是,该功能似乎仍在工作(!)。如果我查看Kudu主机日志,则不会出现任何错误,例如

2020-01-04T23:29:27.639 [Information] Starting JobHost
2020-01-04T23:29:27.641 [Information] Starting Host (HostId=dev-backend, InstanceId=b9a1e02b-faee-4a37-844c-412622583ff7, Version=2.0.12888.0, ProcessId=7440, AppDomainId=1, InDebugMode=True, InDiagnosticMode=False, FunctionsExtensionVersion=~2)
2020-01-04T23:29:27.670 [Information] Loading functions metadata
2020-01-04T23:29:27.699 [Information] 1 functions loaded
2020-01-04T23:29:27.860 [Information] Generating 1 job function(s)
2020-01-04T23:29:27.976 [Information] Found the following functions:
Consumer.Function.ConfigurationUpdated.ExecuteAsync
2020-01-04T23:29:28.097 [Information] Initializing function HTTP routes
No HTTP routes mapped
2020-01-04T23:29:28.105 [Information] Host initialized (449ms)
2020-01-04T23:29:28.459 [Information] Host started (810ms)
2020-01-04T23:29:28.459 [Information] Job host started
2020-01-04T23:29:33.474 [Information] Host lock lease acquired by instance ID 'e4e6f1cb6c07cd9bd67163acfe2dba75'.
我不确定ARM模板中缺少了什么会导致此中断,或者在其他地方查找运行时无法启动的原因……或者甚至不确定它是否真的正常工作

我使用的模板是:

{
  "apiVersion": "2018-02-01",
  "name": "[variables('statisticsBackendContainer')]",
  "type": "Microsoft.Web/sites",
  "kind": "functionapp",
  "location": "[resourceGroup().location]",
  "tags": {
    "service": "statistics",
    "costCenter": "[parameters('costcentre')]",
    "[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', variables('servicePlan'))]": "Resource"
  },
  "dependsOn": [
    "[concat('Microsoft.Web/serverfarms/', variables('servicePlan'))]",
    "[concat('Microsoft.Sql/servers/', variables('databaseServer'))]",
    "[concat('Microsoft.Storage/storageAccounts/', variables('loggingStorageAccount'))]"
  ],
  "properties": {
    "name": "[variables('statisticsBackendContainer')]",
    "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('servicePlan'))]",
    "clientAffinityEnabled": false,
    "httpsOnly": true,
    "hostingEnvironment": "",
    "siteConfig": {
      "phpVersion": "off",
      "Use32BitWorkerProcess": true,
      "AlwaysOn": true,
      "appSettings": [
        {
          "name": "AzureWebJobsStorage",
          "connectionString": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('loggingStorageAccount'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('loggingStorageAccount')), '2016-01-01').keys[0].value)]",
          "type": 3
        },
        {
          "name": "AppSettings:apiSecret",
          "value": "[variables('apiSecret')]"
        },
        {
          "name": "FUNCTIONS_WORKER_RUNTIME",
          "value": "dotnet"
        },
        {
          "name": "FUNCTIONS_EXTENSION_VERSION",
          "value": "~2"
        },
        {
          "name": "APPINSIGHTS_INSTRUMENTATIONKEY",
          "value": "[reference(concat('microsoft.insights/components/',variables('statisticsBackendContainer')), '2015-05-01').InstrumentationKey]"
        }
      ],
      "connectionStrings": [
        {
          "name": "microsoft.servicebus.connectionstring",
          "connectionString": "[listkeys(variables('sendlistenServiceBusNamespace'), '2014-09-01').primaryConnectionString]",
          "type": 3
        },
        {
          "name": "statistics.connection",
          "connectionString": "[concat('Server=tcp:', reference(concat('Microsoft.Sql/servers/', variables('databaseServer'))).fullyQualifiedDomainName, ',1433;Database=', variables('databaseStatisticsName'), ';User Id=', parameters('appLogin'), '@', variables('serviceNameEnvironment'), ';Password=', parameters('appLoginPassword'), ';Encrypt=True;Connection Timeout=30;')]",
          "type": 2
        },
        {
          "name": "logging.connection",
          "connectionString": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('loggingStorageAccount'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('loggingStorageAccount')), '2016-01-01').keys[0].value)]",
          "type": 3
        },
        {
          "name": "management.webhook",
          "connectionString": "[concat('https://',variables('managementApiContainer'),'.azurewebsites.net')]",
          "type": 3
        }
      ]
    }
  }
},

最后,我认为ARM模板有误导性,因为AzureWebJobsStorage应用程序设置在部署的函数应用程序中丢失。当我确定它在ARM模板中并重新部署后,Azure门户中的一切似乎都正常工作。

如果你甚至不共享模板,我们怎么知道缺少了什么?还是函数语言?