Ale*_*AIT 3 azure azure-resource-manager azure-functions
我尝试在 ARM 模板中复制以下 Azure CLI 命令。它基于文档并且工作正常。
az functionapp create --resource-group AzureFunctionsQuickstart-rg --p myappserviceplan --runtime dotnet-isolated --runtime-version 5.0 --functions-version 3 --name <APP_NAME> --storage-account <STORAGE_NAME> --os-type linux
Run Code Online (Sandbox Code Playgroud)
但是,当执行下面的 ARM 模板时,打开 https://<APP_NAME>.azurewebsites.net 后得到的只是Service unavailable. 如果我使用 AZ 命令,我会看到Your Functions 3.0 app is up and running. 通过 Azure Pipelines 发布我的函数func azure functionapp publish似乎在大多数情况下都会超时,尤其是使用 Azure Function App 任务的 Azure Pipelines。
我需要改变什么?
az functionapp create --resource-group AzureFunctionsQuickstart-rg --p myappserviceplan --runtime dotnet-isolated --runtime-version 5.0 --functions-version 3 --name <APP_NAME> --storage-account <STORAGE_NAME> --os-type linux
Run Code Online (Sandbox Code Playgroud)
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appName": {
"type": "string",
"metadata": {
"description": "The name of the function app that you wish to create."
}
},
"storageAccountName": {
"type": "string",
"metadata": {
"description": "The name of the existing storage account."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for app function"
}
},
"hostingPlanName": {
"type": "string",
"metadata": {
"description": "Name of the existing hosting plan to use."
}
}
},
"variables": {
"functionAppName": "[parameters('appName')]"
},
"resources": [
{
"apiVersion": "2020-06-01",
"type": "Microsoft.Web/sites",
"name": "[variables('functionAppName')]",
"location": "[parameters('location')]",
"kind": "functionapp,linux",
"dependsOn": [
],
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]",
"siteConfig": {
"alwaysOn": true,
"appSettings": [
{
"name": "AzureWebJobsStorage",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', parameters('storageAccountName'), ';EndpointSuffix=', environment().suffixes.storage, ';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName')), '2019-06-01').keys[0].value)]"
},
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~3"
},
{
"name": "FUNCTIONS_WORKER_RUNTIME",
"value": "dotnet-isolated"
}
]
}
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
Ale*_*AIT 10
"linuxFxVersion": "DOTNET-ISOLATED|5.0"解决方案是向模板添加一点额外的参数。我过去仅在通过 Azure Pipelines 部署应用程序时才设置此选项,但目前似乎没有此选项也会阻止您的部署。
工作 ARM 模板:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appName": {
"type": "string",
"metadata": {
"description": "The name of the function app that you wish to create."
}
},
"storageAccountName": {
"type": "string",
"metadata": {
"description": "The name of the existing storage account."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for app function"
}
},
"hostingPlanName": {
"type": "string",
"metadata": {
"description": "Name of the existing hosting plan to use."
}
}
},
"variables": {
"functionAppName": "[parameters('appName')]"
},
"resources": [
{
"apiVersion": "2020-06-01",
"type": "Microsoft.Web/sites",
"name": "[variables('functionAppName')]",
"location": "[parameters('location')]",
"kind": "functionapp,linux",
"dependsOn": [
],
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]",
"siteConfig": {
"alwaysOn": true,
"appSettings": [
{
"name": "AzureWebJobsStorage",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', parameters('storageAccountName'), ';EndpointSuffix=', environment().suffixes.storage, ';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName')), '2019-06-01').keys[0].value)]"
},
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~3"
},
{
"name": "FUNCTIONS_WORKER_RUNTIME",
"value": "dotnet-isolated"
}
],
"linuxFxVersion": "DOTNET-ISOLATED|5.0"
}
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
828 次 |
| 最近记录: |