ARM Deployment template validation failed

Taranjeet Malik 546 Reputation points
2024-04-05T07:06:54.3433333+00:00

Hi

I'm exporting ARM Template for an API Management instance (completely functional in source environment) and importing it to target. While deploying the template at target, the deployment validation fails and reports this:

Deployment template validation failed: 'The template resource 'abc-ps-sh-apim/imagesitadetectionfunc;rev=1/post-lprdetecthttptrigv2' at line '9204' and column '5' is not valid: The language expression '
  {
    "uid": 1234,
    "created": "2019-10-10 17:30:26+05:30",
    "frames": [
      {
        "uid": 123,
        "type": "context",
        "URL": "https://apidemos01.snbos.com/senapi/public/events/eventsFrames/379759"
      },
      {
        "uid": 121,
        "type": "plate",
        "URL": "https://apidemos01.snbos.com/senapi/public/events/eventsFrames/379758"
      }
    ],
    "positions": [
      {
        "latitude": "23.456372",
        "longitude": "143.103301597",
        "method": "gps"
      }
    ],
    "confidence": 90,
    "registrationNumbers": [
      {
        "ocr": "ABC128",
        "rank": 1
      },
      {
        "ocr": "ABC12B",
        "rank": 2
      }
    ],
    "host": {
      "uid": "sensen-car-01",
      "description": "sensen-car-01 GeelongCouncil"
    }
  }
' is not valid: the string character '{' at position '3' is not expected.

I checked the code snippet at the specified location using VSCode and could not visibly make out anything. VSCode is not highlighting any issues at all (have ARM Toolkit extension installed). The fact that this is just a template that I'm directly exporting from functional source environment, indicates that ARM cannot be invalid.

Can someone please point me in the right direction - what to look for, any know issues etc.?

Thanks

Taranjeet Singh

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,116 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 70,421 Reputation points
    2024-04-08T06:11:25.93+00:00

    @Taranjeet Malik Thanks for reaching out. As per the error message have you reviewed line number 9204 in your template? Looks like you have string character '{' in line 9204 which is not expected or incorrect with the opening and closing braces.

    Update:

    As per the thread, here you were able to figure out the issue with it. It turns out that there's a description key within the properties section of one of the resources. The value for this key had a long string with some escape characters. Once you commented that key and the template validated successfully.

    Please 'Accept Answer' if it helped so that it can help others in the community looking for help on similar topics.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.