Error when deploying App Service Plan using template, 'Required property 'name' not found in JSON. Path ''.'

Just a quick article to save you the time it took me to realize what exactly was the problem in my template because the error message was not of much help here ;)

I exported an Azure template from an existing resource group in the portal. The resulting template had a lot of resources and properties that are not necessary IMO and that honestly mix me up more than it should but this is another debate for the Azure team ;)

So after a lot of refactoring in my template to remove a lot of "noise" from it, I ended up with the following error while deploying this particular resource:

{
  "type": "Microsoft.Web/serverfarms",
  "name": "unique-name-of-my-app-service",
  "apiVersion": "2015-08-01",
  "location": "Canada East",
  "sku": {
    "tier": "Basic",
    "size": "B2",
    "family": "B",
    "capacity": 1
  },
  "properties": {
    "numberOfWorkers": 1
  }
}

New-AzureRmResourceGroupDeployment : 7:48:44 AM - Error: Code=InvalidTemplate; Message=Deployment template parse
failed: 'Required property 'name' not found in JSON. Path ''.'.
At J:\wkspc\Invoke-AzureProvisioning.ps1:19 char:1

  • New-AzureRmResourceGroupDeployment -ResourceGroupName $rg.ResourceGro ...
  •   + CategoryInfo          : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
      + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
    
    

New-AzureRmResourceGroupDeployment : The deployment validation failed
At J:\wkspc\Invoke-AzureProvisioning.ps1:19 char:1

  • New-AzureRmResourceGroupDeployment -ResourceGroupName $rg.ResourceGro ...
  •   + CategoryInfo          : CloseError: (:) [New-AzureRmResourceGroupDeployment], InvalidOperationException
      + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
    
    

The problem was that in my refactoring I ended up removing the sku/name member among other things and it was that name the error message was referring to .

{
  "type": "Microsoft.Web/serverfarms",
  "name": "unique-name-of-my-app-service",
  "apiVersion": "2015-08-01",
  "location": "Canada East",
  "sku": {
    "name": "B2",
    "tier": "Basic",
    "size": "B2",
    "family": "B",
    "capacity": 1
  },
  "properties": {
    "numberOfWorkers": 1
  }
}

After working a bit more with the app service plan resource I ended up with the following slimmed version:

{
  "type": "Microsoft.Web/serverfarms",
  "name": "unique-name-of-my-app-service",
  "apiVersion": "2015-08-01",
  "location": "Canada East",
  "sku": {
    "name": "S1",
    "tier": "Standard",
    "capacity": 1
  },
  "properties": {}
}

Have a good gay deploying template in Azure!!