Unexpected character encountered while parsing value

David Haver 25 Reputation points
2023-05-11T16:59:15.22+00:00

I am trying to run a mongodb script from within my ARM Template and I keep getting this error.

Here is my resource from my template.

            "type": "Microsoft.Resources/deployments",
            "apiVersion": "2021-04-01",
            "name": "createMongoDBSchema",
            "dependsOn": [
                "[resourceId('Microsoft.DocumentDB/databaseAccounts/mongodbDatabases', parameters('document_db_name'), parameters('environment_type'))]"
            ],
            "properties": {
                "mode": "Incremental",
                "templateLink": {
                    "uri": "[parameters('documentdb_schema_script')]",
                    "contentVersion": "1.0.0.0"
                },
                "parameters": {
                    "cosmosDbAccountName": {
                    "value": "[parameters('document_db_name')]"
                    },
                "mongoDbDatabaseName": {
                    "value": "[parameters('document_db_name')]"
                    }
                }
            }
        },   

The documentdb_schema_script is a .mongodb file that we have in an azure storage account.
Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,901 questions
{count} votes

4 answers

Sort by: Most helpful
  1. GeethaThatipatri-MSFT 29,542 Reputation points Microsoft Employee Moderator
    2023-05-11T18:04:43.66+00:00

    Hi, @Anonymous Welcome to the Microsoft Q&A forum, Thanks for posting your question.

    Looks like this is a JSON syntax issue, I hope you have converted the .mongodb file to a JSON file without any syntax issues, for the above resource can you try removing the trailing comma and give it a try?

    User's image

    Regards

    Geetha

    0 comments No comments

  2. Soumen Das 10 Reputation points
    2023-05-11T20:36:03.4133333+00:00

    Hi,

    Have you declared the parameters correctly ? I can see both cosmosDbAccountName & mongoDbDatabaseName are assigned to document_db_name. Can you please pin point the exact error message you are getting ?

    0 comments No comments

  3. GeethaThatipatri-MSFT 29,542 Reputation points Microsoft Employee Moderator
    2023-05-11T22:34:17.5+00:00

    @Anonymous To convert your .mongodb file to a JSON file, you can refer to this document https://www.mongodb.com/docs/database-tools/mongoexport/

    Regards

    Geetha

    0 comments No comments

  4. David Haver 25 Reputation points
    2023-05-16T19:54:49.72+00:00

    I have changed directions. Instead of doing the above, I am now going to use deployment scripts to run PS scripts to make the connection and create the schema and add seed data. Thanks for your help with this.


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.