簡體   English   中英

部署 azure function 應用程序時出現 ARM 模板錯誤

[英]ARM template error while deploying azure function app

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 相關請求 ID:78006c94-253a-4b3f-8407-0d7690a7ca5d
2021-01-04T11:03:16.0663958Z ##[error]InternalServerError:出現意外的 InternalServerError。 請稍后再試。 x-ms 相關請求 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 相關請求 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/部署/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": {}}

根據文檔,我們可以看到導致此類錯誤的多種原因:

  • 您嘗試部署的資源類型在該區域尚不可用。
  • 在您要部署到的區域中,您要部署到的任一服務的停機時間。
  • Azure DevOps 本身的停機時間。

您可以切換區域,然后再試一次。

In addition, We could create ARM templates by using the Azure portal and then deploy azure function app via the template.

我可以用你的模板重現同樣的問題。 請注意,模板中沒有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')))]"
        }
    }

在此處輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM