【问题标题】:ARM template error while deploying azure function app部署 azure 函数应用时出现 ARM 模板错误
【发布时间】:2021-04-10 04:59:06
【问题描述】:

2021-01-04T11:03:16.0647360Z ##[错误]至少一项资源部署操作失败。请列出部署操作以了解详细信息。使用详情请查看https://aka.ms/DeployOperations
2021-01-04T11:03:16.0659882Z ##[错误]详情:
2021-01-04T11:03:16.0662124Z ##[error]InternalServerError:出现意外的 InternalServerError。请稍后再试。 x-ms-correlation-request-id: 78006c94-253a-4b3f-8407-0d7690a7ca5d
2021-01-04T11:03:16.0663958Z ##[error]InternalServerError:出现意外的 InternalServerError。请稍后再试。 x-ms-correlation-request-id: 78006c94-253a-4b3f-8407-0d7690a7ca5d
2021-01-04T11:03:16.0665674Z ##[error]InternalServerError:出现意外的 InternalServerError。请稍后再试。 x-ms-相关请求-id:78006c94-253a-4b3f-8407-0d7690a7ca5d
2021-01-04T11:03:16.0667350Z ##[error]InternalServerError:出现意外的 InternalServerError。请稍后再试。 x-ms-correlation-request-id: 78006c94-253a-4b3f-8407-0d7690a7ca5d
2021-01-04T11:03:16.0669314Z ##[error]InternalServerError:出现意外的 InternalServerError。请稍后再试。 x-ms-相关请求-id:78006c94-253a-4b3f-8407-0d7690a7ca5d
2021-01-04T11:03:16.0671142Z ##[错误]查看故障排除指南以查看您的问题是否得到解决:https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-resource-group-deployment?view=azure-devops#troubleshooting
2021-01-04T11:03:16.0672521Z ##[错误]创建或更新模板部署时任务失败。


{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
    "current_environment": {
        "type": "string"
    },
    "instanceNo": {
        "type": "string"
    },
    "current_app_name": {
        "type": "string"
    },
    "current_app_name_short": {
        "type": "string",
        "defaultValue":"66"
        // "maxLength": 4
    },
    "functionName": {
        "type": "array",
        "defaultValue": [
            "searchindex",
            "delta",
            "product",
            "catalog",
            "category"
        ]
    },
    "vnetName": {
        "type": "string",
        "defaultValue":"networking-001"
    },
    "existingVirtualNetworkResourceGroup": {
        "type": "string",
        "defaultValue": "rg-networking-001"
    }


},
"functions": [],
"variables": {
    "commonprefix": "[concat(parameters('current_app_name'),'-',parameters('current_environment'),'-',parameters('instanceNo'))]",
    "commonprefix1":"[concat(parameters('current_app_name_short'),parameters('current_environment'),parameters('instanceNo'))]"
},
"resources": [
    {
        "apiVersion": "2018-02-01",
        "name": "[concat('plan-',parameters('functionName')[copyIndex('')],'-',variables('commonprefix'))]",
        "type": "Microsoft.Web/serverfarms",
        "location": "[resourceGroup().location]",
        "kind": "linux",
        "dependsOn": [],
        "properties": {
            "name": "[concat('plan-',parameters('functionName')[copyIndex('')],'-',variables('commonprefix'))]",
            "workerSize": "3",
            "workerSizeId": "3",
            "numberOfWorkers": "1",
            "reserved": true
        },
        "sku": {
            "Tier": "PremiumV2",
            "Name": "P1v2"
        },
        "copy": {
            "name": "appplancopy",
            "count": "[length(parameters('functionName'))]"
        }

    },
    {
        "type": "microsoft.insights/components",
        "apiVersion": "2018-05-01-preview",
        "name": "[concat('appi-',parameters('functionName')[copyIndex('')],'-',variables('commonprefix'))]",
        "kind": "web",
        "location": "[resourceGroup().location]",
        "dependsOn": [],
        "properties": {
            "Application_Type": "web",
            "RetentionInDays": 90,
            "publicNetworkAccessForIngestion": "enabled",
            "publicNetworkAccessForQuery": "enabled"
        },
        "copy": {
            "name": "componentcopy",
            "count": "[length(parameters('functionName'))]"
        }
    },
    {
        "apiVersion": "2019-06-01",
        "type": "Microsoft.Storage/storageAccounts",
        "name": "[concat('st',parameters('functionName')[copyIndex('')],variables('commonprefix1'))]",
        "location": "[resourceGroup().location]",
        "kind": "Storage",
        "sku": {
            "name": "Standard_LRS"
        },
        "properties": {
            "supportsHttpsTrafficOnly": true
        },
        "copy": {
            "name": "storagecopy",
            "count": "[length(parameters('functionName'))]"
        }
    },
    {
        "apiVersion": "2018-11-01",
        "name": "[concat('func-',parameters('functionName')[copyIndex('')],'-',variables('commonprefix'))]",
        "type": "Microsoft.Web/sites",
        "kind": "functionapp,linux",
        "location": "[resourceGroup().location]",
        "dependsOn": [
            "[resourceId('microsoft.insights/components', concat('appi-',parameters('functionName')[copyIndex('')],'-',variables('commonprefix')))]",
            "[resourceId('Microsoft.Web/serverfarms', concat('plan-',parameters('functionName')[copyIndex('')],'-',variables('commonprefix')))]",
            "[resourceId('Microsoft.Storage/storageAccounts', concat('st',parameters('functionName')[copyIndex('')],variables('commonprefix1')))]"

        ],
        "properties": {
            
            "name": "[concat('func-',parameters('functionName')[copyIndex('')],'-',variables('commonprefix'))]",
            "clientAffinityEnabled": false,
            "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', concat('plan-',parameters('functionName')[copyIndex('')],'-',variables('commonprefix')))]"
        },
        "resources": [
            {
                "type": "networkConfig",
                "apiVersion": "2019-08-01",
                "name": "virtualNetwork",
                "dependsOn": [
                    "[resourceId('Microsoft.Web/sites', concat('func-',parameters('functionName')[copyIndex('')],'-',variables('commonprefix')))]"
                ],
                "properties": {
                    "subnetResourceId": "[resourceId(parameters('existingVirtualNetworkResourceGroup'),'Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'),concat('subnet-',parameters('functionName')[copyIndex('')],'-',variables('commonprefix')))]"
                }
            }
        ],
        "copy": {
            "name": "apppservicecopy",
            "count": "[length(parameters('functionName'))]"
        }
    }
],
"outputs": {}}

【问题讨论】:

  • 验证完成没有错误,部署时出错,部署位置是西欧
  • 好吧,这似乎是一个可重试的错误,请稍后再试
  • 我已经尝试了5次以上
  • 嗯,关键字是“稍后”。你从哪里得到模板的?来自官方来源还是您自己创建的?
  • 嗨@pappu.jerin,如果Nancy 的回答有帮助,请accept it 作为答案吗?因此,它可以帮助遇到相同问题的其他社区成员,我们可以存档此线程。谢谢。祝你今天过得愉快。 :)

标签: azure azure-devops azure-resource-manager azure-function-app


【解决方案1】:

根据doc,我们可以看到导致此类错误的多种原因:

  • 您尝试部署的资源类型在该地区尚不可用。
  • 您要部署到的任一服务在您要部署到的区域中发生停机。
  • Azure DevOps 本身的停机时间。

您可以切换区域,然后再试一次。

另外,我们可以通过 Azure 门户create ARM templates,然后通过模板部署 azure function app。

【讨论】:

    【解决方案2】:

    我可以用您的模板重现同样的问题。请注意,模板中没有networkConfig 类型和subnetResourceId 属性-Microsoft.Web sites/virtualNetworkConnections 2019-08-01,您可以将类型更改为virtualNetworkConnections,将属性更改为vnetResourceId,如下所示:

        {
            "type": "virtualNetworkConnections",
            "apiVersion": "2019-08-01",
            "name": "virtualNetwork",
            "dependsOn": [
                "[resourceId('Microsoft.Web/sites', concat('func-',parameters('functionName')[copyIndex('')],'-',variables('commonprefix')))]"
            ],
            "properties": {
                "vnetResourceId": "[resourceId(parameters('existingVirtualNetworkResourceGroup'),'Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'),concat('subnet-',parameters('functionName')[copyIndex('')],'-',variables('commonprefix')))]"
            }
        }
    

    【讨论】:

    • 我试图将函数应用子网连接部署为 ARM 模板中的子资源,子资源不支持迭代,这对我来说是个问题,而您的答案是正确的。谢谢,
    • 子资源不支持迭代是什么意思?你看过我的验证样本吗?我使用了一个名为concat('subnet-',parameters('functionName')[copyIndex('')],'-',variables('commonprefix')) 的现有子网列表,然后它可以创建函数应用程序并迭代地与每个子网集成。
    猜你喜欢
    • 2022-08-20
    • 1970-01-01
    • 2021-07-09
    • 2020-12-05
    • 2019-02-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多