无法通过 arm 模板部署 azure function app
unable to deploy azure function app through the arm template
您好,我已经使用 .net 核心创建了 azure funnction 应用程序。我通过管理门户创建了一切。它工作正常。我正在尝试为资源创建编写 arm 模板。所以我从门户网站导出了 arm 模板,并通过 azure devops 我 运行 它来创建资源。我选择了增量更改。下面是我的示例模板。
{
"type": "Microsoft.Web/sites",
"apiVersion": "2018-11-01",
"name": "[variables('fetchSciHubProductURLName')]",
"location": "[parameters('location')]",
"tags": {
"BU": "[parameters('Division')]",
"Environment": "[parameters('environment')]"
},
"kind": "functionapp,linux",
"properties": {
"serverFarmId": "[parameters('serverfarms_APSERDEVDVLGENSEAWE01_Linux_externalid')]",
"clientAffinityEnabled": false,
"httpsOnly": false,
"siteConfig": {
"reservedInstanceCount": "0",
"appSettings": [
{
"name": "AzureWebJobsStorage",
"value": "secrete"
},
{
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
"value": "[parameters('storageAccount01APPINSIGHTS_INSTRUMENTATIONKEY')]"
},
{
"name": "APPLICATIONINSIGHTS_CONNECTION_STRING",
"value": "[parameters('storageAccount01APPLICATIONINSIGHTS_CONNECTION_STRING')]"
},
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~3"
},
{
"name": "FUNCTIONS_WORKER_RUNTIME",
"value": "dotnet"
},
{
"name": "WEBSITE_ENABLE_SYNC_UPDATE_SITE",
"value": "true"
},
{
"name": "WEBSITE_RUN_FROM_PACKAGE",
"value": "1"
},
{
"name": "WEBSITES_ENABLE_APP_SERVICE_STORAGE",
"value": "true"
},
{
"name": "test1",
"value": "true"
}
]
}
}
},
{
"type": "Microsoft.Web/sites/functions",
"apiVersion": "2018-11-01",
"name": "[concat(variables('fetchSciHubProductURLName'), '/getproductsfromcoordinates')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', variables('fetchSciHubProductURLName'))]"
],
"properties": {
"script_root_path_href": "https://testqwe123.azurewebsites.net/admin/vfs/home/site/wwwroot/getproductsfromcoordinates/",
"script_href": "https://testqwe123.azurewebsites.net/admin/vfs/home/site/wwwroot/bin/DemoThirdPartyDataDownload.AzFunction.dll",
"config_href": "https://testqwe123.azurewebsites.net/admin/vfs/home/site/wwwroot/getproductsfromcoordinates/function.json",
"href": "https://testqwe123.azurewebsites.net/admin/functions/getproductsfromcoordinates",
"config": {}
}
},
{
"type": "Microsoft.Web/sites/functions",
"apiVersion": "2018-11-01",
"name": "[concat(variables('fetchSciHubProductURLName'), '/UploadFilesToAzureStorage')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', variables('fetchSciHubProductURLName'))]"
],
"properties": {
"script_root_path_href": "https://testqwe123.azurewebsites.net/admin/vfs/home/site/wwwroot/UploadFilesToAzureStorage/",
"script_href": "https://testqwe123.azurewebsites.net/admin/vfs/home/site/wwwroot/bin/DemoThirdPartyDataDownload.AzFunction.dll",
"config_href": "https://testqwe123.azurewebsites.net/admin/vfs/home/site/wwwroot/UploadFilesToAzureStorage/function.json",
"href": "https://testqwe123.azurewebsites.net/admin/functions/UploadFilesToAzureStorage",
"config": {}
}
}
Microsoft,我对以下类型有疑问。Web/sites/functions
当我签入此代码时,Microsoft.Web/sites/functions 都失败了。它使我低于错误。
{
"Code": "BadRequest",
"Message": "Encountered an error (InternalServerError) from host runtime.",
"Target": null,
"Details": [
{
"Message": "Encountered an error (InternalServerError) from host runtime."
},
{
"Code": "BadRequest"
},
{
"ErrorEntity": {
"Code": "BadRequest",
"Message": "Encountered an error (InternalServerError) from host runtime."
}
}
],
"Innererror": null
}
花了几个小时来弄清楚,但仍然没有找到。有人可以帮助我在这里做错什么吗?任何帮助都会很有帮助谢谢
使用 ARM 模板常常令人恼火。对于调试,我推荐以下策略。要让事情正常进行,请跳过通过任何类型的 devops 管道进行部署。相反,通过 ARM 项目直接部署 Visual Studio。
接下来,将模板拆分为单个资源,并让该资源正常工作。这可能涉及将资源模板本身剥离到最低限度以使其正常工作,然后将属性一一添加回来,直到您找出问题所在。
在上面的示例中,我将从“fetchSciHubProductURLName”资源开始。
从 Visual Studio 部署的优点是在部署前验证模板,这样您可能会收到更好的错误消息。
ARM 模板架构也是一种方便的资源 published here。还有其他 ARM 资源的架构。
您好,我已经使用 .net 核心创建了 azure funnction 应用程序。我通过管理门户创建了一切。它工作正常。我正在尝试为资源创建编写 arm 模板。所以我从门户网站导出了 arm 模板,并通过 azure devops 我 运行 它来创建资源。我选择了增量更改。下面是我的示例模板。
{
"type": "Microsoft.Web/sites",
"apiVersion": "2018-11-01",
"name": "[variables('fetchSciHubProductURLName')]",
"location": "[parameters('location')]",
"tags": {
"BU": "[parameters('Division')]",
"Environment": "[parameters('environment')]"
},
"kind": "functionapp,linux",
"properties": {
"serverFarmId": "[parameters('serverfarms_APSERDEVDVLGENSEAWE01_Linux_externalid')]",
"clientAffinityEnabled": false,
"httpsOnly": false,
"siteConfig": {
"reservedInstanceCount": "0",
"appSettings": [
{
"name": "AzureWebJobsStorage",
"value": "secrete"
},
{
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
"value": "[parameters('storageAccount01APPINSIGHTS_INSTRUMENTATIONKEY')]"
},
{
"name": "APPLICATIONINSIGHTS_CONNECTION_STRING",
"value": "[parameters('storageAccount01APPLICATIONINSIGHTS_CONNECTION_STRING')]"
},
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~3"
},
{
"name": "FUNCTIONS_WORKER_RUNTIME",
"value": "dotnet"
},
{
"name": "WEBSITE_ENABLE_SYNC_UPDATE_SITE",
"value": "true"
},
{
"name": "WEBSITE_RUN_FROM_PACKAGE",
"value": "1"
},
{
"name": "WEBSITES_ENABLE_APP_SERVICE_STORAGE",
"value": "true"
},
{
"name": "test1",
"value": "true"
}
]
}
}
},
{
"type": "Microsoft.Web/sites/functions",
"apiVersion": "2018-11-01",
"name": "[concat(variables('fetchSciHubProductURLName'), '/getproductsfromcoordinates')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', variables('fetchSciHubProductURLName'))]"
],
"properties": {
"script_root_path_href": "https://testqwe123.azurewebsites.net/admin/vfs/home/site/wwwroot/getproductsfromcoordinates/",
"script_href": "https://testqwe123.azurewebsites.net/admin/vfs/home/site/wwwroot/bin/DemoThirdPartyDataDownload.AzFunction.dll",
"config_href": "https://testqwe123.azurewebsites.net/admin/vfs/home/site/wwwroot/getproductsfromcoordinates/function.json",
"href": "https://testqwe123.azurewebsites.net/admin/functions/getproductsfromcoordinates",
"config": {}
}
},
{
"type": "Microsoft.Web/sites/functions",
"apiVersion": "2018-11-01",
"name": "[concat(variables('fetchSciHubProductURLName'), '/UploadFilesToAzureStorage')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', variables('fetchSciHubProductURLName'))]"
],
"properties": {
"script_root_path_href": "https://testqwe123.azurewebsites.net/admin/vfs/home/site/wwwroot/UploadFilesToAzureStorage/",
"script_href": "https://testqwe123.azurewebsites.net/admin/vfs/home/site/wwwroot/bin/DemoThirdPartyDataDownload.AzFunction.dll",
"config_href": "https://testqwe123.azurewebsites.net/admin/vfs/home/site/wwwroot/UploadFilesToAzureStorage/function.json",
"href": "https://testqwe123.azurewebsites.net/admin/functions/UploadFilesToAzureStorage",
"config": {}
}
}
Microsoft,我对以下类型有疑问。Web/sites/functions 当我签入此代码时,Microsoft.Web/sites/functions 都失败了。它使我低于错误。
{
"Code": "BadRequest",
"Message": "Encountered an error (InternalServerError) from host runtime.",
"Target": null,
"Details": [
{
"Message": "Encountered an error (InternalServerError) from host runtime."
},
{
"Code": "BadRequest"
},
{
"ErrorEntity": {
"Code": "BadRequest",
"Message": "Encountered an error (InternalServerError) from host runtime."
}
}
],
"Innererror": null
}
花了几个小时来弄清楚,但仍然没有找到。有人可以帮助我在这里做错什么吗?任何帮助都会很有帮助谢谢
使用 ARM 模板常常令人恼火。对于调试,我推荐以下策略。要让事情正常进行,请跳过通过任何类型的 devops 管道进行部署。相反,通过 ARM 项目直接部署 Visual Studio。
接下来,将模板拆分为单个资源,并让该资源正常工作。这可能涉及将资源模板本身剥离到最低限度以使其正常工作,然后将属性一一添加回来,直到您找出问题所在。
在上面的示例中,我将从“fetchSciHubProductURLName”资源开始。
从 Visual Studio 部署的优点是在部署前验证模板,这样您可能会收到更好的错误消息。
ARM 模板架构也是一种方便的资源 published here。还有其他 ARM 资源的架构。