Home > database >  Visual Studio Code on Azure ARM template reports unable to load schema - unexpected end of file
Visual Studio Code on Azure ARM template reports unable to load schema - unexpected end of file

Time:01-24

Using an ARM template, taken from a Microsoft example, I have this:

"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",

which results in this:

Unable to load schema from 'http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json': unexpected end of file.

When I manually retrieve the schema file, it returns this:

{"id":"https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#","$schema":"http://json-schema.org/draft-04/schema#","title":"Parameters","description":"An Azure deployment parameter file","type":"object","properties":{"$schema":{"type":"string"},"contentVersion":{"type":"string","pattern":"(^[0-9] \\.[0-9] \\.[0-9] \\.[0-9] $)","description":"A 4 number format for the version number of this parameter file. For example, 1.0.0.0"},"parameters":{"type":"object","additionalProperties":{"$ref":"#/definitions/parameter"},"description":"Collection of parameters to pass into a template"}},"additionalProperties":false,"required":["$schema","contentVersion","parameters"],"definitions":{"parameter":{"type":"object","properties":{"value":{"$ref":"https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#/definitions/parameterValueTypes","description":"Input value to template"},"reference":{"$ref":"https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#/definitions/keyVaultReference","description":"KeyVault parameter reference"},"metadata":{"type":"object","description":"Client specific metadata"}},"additionalProperties":false,"oneOf":[{"required":["value"]},{"required":["reference"]}]}}}

The above passes several types of json validation including jsonlint, so I don't see why VSCode is complaining about it.

Anybody solve this problem?

CodePudding user response:

As per this document, use the latest version of $schema

If you're using Visual Studio Code with the Azure Resource Manager tools extension, use the latest version for resource group deployments: https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#

Use this version 2019-04-01 instead of 2014-04-01-preview

CodePudding user response:

I would use a more updated schema like:

https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json

using:

"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  •  Tags:  
  • Related