Jerin Joy
Jerin Joy

Reputation: 63

ARM template error while deploying azure function app

2021-01-04T11:03:16.0647360Z ##[error]At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.
2021-01-04T11:03:16.0659882Z ##[error]Details:
2021-01-04T11:03:16.0662124Z ##[error]InternalServerError: There was an unexpected InternalServerError. Please try again later. x-ms-correlation-request-id: 78006c94-253a-4b3f-8407-0d7690a7ca5d
2021-01-04T11:03:16.0663958Z ##[error]InternalServerError: There was an unexpected InternalServerError. Please try again later. x-ms-correlation-request-id: 78006c94-253a-4b3f-8407-0d7690a7ca5d
2021-01-04T11:03:16.0665674Z ##[error]InternalServerError: There was an unexpected InternalServerError. Please try again later. x-ms-correlation-request-id: 78006c94-253a-4b3f-8407-0d7690a7ca5d
2021-01-04T11:03:16.0667350Z ##[error]InternalServerError: There was an unexpected InternalServerError. Please try again later. x-ms-correlation-request-id: 78006c94-253a-4b3f-8407-0d7690a7ca5d
2021-01-04T11:03:16.0669314Z ##[error]InternalServerError: There was an unexpected InternalServerError. Please try again later. x-ms-correlation-request-id: 78006c94-253a-4b3f-8407-0d7690a7ca5d
2021-01-04T11:03:16.0671142Z ##[error]Check out the troubleshooting guide to see if your issue is addressed: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-resource-group-deployment?view=azure-devops#troubleshooting
2021-01-04T11:03:16.0672521Z ##[error]Task failed while creating or updating the template deployment.


{
"$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": {}}

Upvotes: 0

Views: 3140

Answers (2)

Nancy Xiong
Nancy Xiong

Reputation: 28224

I can reproduce the same issue with your template. Please note that there is no networkConfig type and subnetResourceId properties in the template-Microsoft.Web sites/virtualNetworkConnections 2019-08-01, you could change the type to virtualNetworkConnections and properties to vnetResourceId like this:

    {
        "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')))]"
        }
    }

enter image description here

Upvotes: 1

Vito Liu
Vito Liu

Reputation: 8298

According to the doc, we could see multiple reasons for this type of error:

  • The resource type you're trying to deploy isn't yet available in that region.
  • Downtime of either the service you're deploying to in the region you're deploying to.
  • Downtime of Azure DevOps itself.

You could switch the region and then try it again.

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

Upvotes: 1

Related Questions