Search code examples
jsonazure-web-app-serviceazure-resource-managerazure-rm-template

Azure ARM template deployment. The value for template parameter not provided


I am extending one of the Azure quick start template to deploy Azure Web App with VNET integration. The RG, network components and App Service plan are already created (using powershell). I am using the ARM template to deploy the Web App. But I am getting the below error while performing the deployment.

I used JSON Lint, to validate the JSON and looks like it is fine. The error code tells me that there is an issue with the parameter file's syntax, but I am not able to pinpoint it. I tried many things to debug this but not able to fix it.

Error:

PS C:\Users\manjug\Desktop> New-AzResourceGroupDeployment `
        -Name 'test01' `
        -ResourceGroupName ITQIG-eu-manjug-windows-app `
        -TemplateParameterUri C:\Users\manjug\Desktop\azuredeploy_webapp.parameters.json `
        -TemplateUri C:\Users\manjug\Desktop\azuredeploy_webapp.json `
        -Verbose
VERBOSE: Performing the operation "Creating Deployment" on target "ITQIG-eu-manjug-windows-app".
New-AzResourceGroupDeployment : 2:22:59 PM - Error: Code=InvalidTemplate; Message=Deployment template validation failed: 'The value for the template parameter 'appName' at line '7' and 
column '20' is not provided. Please see https://aka.ms/resource-manager-parameter-files for usage details.'.
At line:1 char:1
+ New-AzResourceGroupDeployment `
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-AzResourceGroupDeployment], Exception
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
 
New-AzResourceGroupDeployment : The deployment validation failed
At line:1 char:1
+ New-AzResourceGroupDeployment `
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [New-AzResourceGroupDeployment], InvalidOperationException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet

azuredeploy_webapp.parameter.json:

    {
      "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
      "contentVersion": "1.0.0.0",
      "parameters": {
        "appName": {
          "value": "ITQIG-eu-web-manju123"
        },
        "kind": {
          "value": "app"
        },
        "location": {
          "value": "west europe"
        },
        "subnetResourceID": {
          "value": "/subscriptions/7e7f55d3-4bfd-a6be-1c59594b8592/resourceGroups/ITQIG-eu-network-dev/providers/Microsoft.Network/virtualNetworks/ITQIG-eu-vnet-dev/subnets/subnet7-AWmanjug"
        },
        "appServicePlanResourceID": {
          "value": "/subscriptions/7e7f55d3-4bfd-a6be-1c59594b8592/resourceGroups/ITQIG-eu-manjug-windows-app/providers/microsoft.web/serverFarms/eu-manjug-windows-plan"
        }
      }
    }

azuredeploy_webapp.json

{
  "$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 app to create."
      }
    },
    "kind": {
      "type": "string",
      "metadata": {
        "description": "Web app kind. OS type -> Windows / Linux."
      }
    },
    "appServicePlanResourceID": {
      "metadata": {
        "description": "The resource ID of the app service plan."
      },
      "type": "string"
    },
    "location": {
      "type": "string",
      "defaultValue": "[resourceGroup().location]",
      "metadata": {
        "description": "The location in which all resources should be deployed."
      }
    },
    "subnetResourceID": {
      "type": "string",
      "metadata": {
        "description": "The subnet resource ID created for app service plan which contains this web app."
      }
    }
  },
  "resources": [
    {
      "type": "Microsoft.Web/sites",
      "apiVersion": "2019-08-01",
      "name": "[parameters('appName')]",
      "location": "[parameters('location')]",
      "kind": "[parameters('kind')]",
      "properties": {
        "serverFarmId": "[parameters('appServicePlanResourceID')]"
      },
      "resources": [
        {
          "name": "virtualNetwork",
          "type": "networkConfig",
          "apiVersion": "2019-08-01",
          "dependsOn": [
            "[resourceId('Microsoft.Web/sites', parameters('appName'))]"
          ],
          "properties": {
            "subnetResourceId": "[parameters('subnetResourceId')]",
            "swiftSupported": true
          }
        }
      ]
    }
  ]
}

Solution

  • I deleted the old file and re-created a new JSON file with the same contents. It is working now. I do not know what caused the issue with the old file though..