嗨,我已经创建了一个具有.net核心的Azure功能应用程序。我通过管理门户创建了所有内容。它的工作正常。我正在尝试为资源创建编写手臂模板。因此,我从门户网站导出了手臂模板,并通过azure devops运行它来创建资源。我选择了增量更改。下面是我的示例模板。
fetch('https://drag13.io/')
.then((rawResponse)=> console.log(rawResponse.headers.get('content-length')))
我对以下类型(Microsoft.Web /站点/功能)有疑问 当我签入此代码时,两个Microsoft.Web / sites / functions均失败。它使我误入歧途。
{
"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": {}
}
}
花了几个小时才能弄清楚,但仍然找不到。有人可以帮我在这里做错什么吗?任何帮助都会真正有帮助,谢谢
答案 0 :(得分:1)
使用ARM模板常常令人发指。对于调试,我建议采用以下策略。为了使事情顺利进行,请跳过通过任何类型的devops管道进行部署。而是直接通过ARM项目在Visual Studio中进行部署。
接下来,将模板剥离为单个资源,然后使该资源正常工作。这可能涉及将资源模板本身剥离到最低限度以使其正常工作,然后将属性一个接一个地添加回去,直到找出问题所在为止。
在上面的示例中,我将从“ fetchSciHubProductURLName”资源开始。
从Visual Studio部署具有在部署之前验证模板的优势,这样您可能会获得更好的错误消息。
作为方便的资源,ARM模板架构为published here。还有其他ARM资源的架构。