Skip to content

Fix broken Cosmos DB ARM deployment template - #192

Open
Manya Sharma (ManyaS-Git) wants to merge 1 commit into
microsoft:masterfrom
ManyaS-Git:fix/cosmosdb-arm-template
Open

Fix broken Cosmos DB ARM deployment template#192
Manya Sharma (ManyaS-Git) wants to merge 1 commit into
microsoft:masterfrom
ManyaS-Git:fix/cosmosdb-arm-template

Conversation

@ManyaS-Git

Copy link
Copy Markdown

Summary

AzureDeployment/CosmosDB/cosmosdb.json was not valid JSON, so the template could not be parsed — let alone deployed — by Azure Resource Manager. It has been broken since it was added in PR #18.

Three problems:

  1. Missing closing brace — the Microsoft.DocumentDB/databaseAccounts resource was never closed, so json.load fails immediately (Expecting property name enclosed in double quotes: line 44).
  2. Missing comma — the database and container resources were not separated by a comma.
  3. Incorrect child-resource type paths — the database and container were declared as top-level resources but with the wrong types (Microsoft.DocumentDB/sqlDatabases, Microsoft.DocumentDB/containers). As top-level child resources they must use the full parent path (Microsoft.DocumentDB/databaseAccounts/sqlDatabases and Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers) and their name must be prefixed with the parent resource name. The container's dependsOn was updated to reference the full database resource name.

Verification

  • json.load now succeeds — the file is valid JSON.
  • Every resource uses the correct provider type path and parent-prefixed name, matching the documented Cosmos DB ARM pattern.
  • The rest of the template (parameters, properties, outputs) is unchanged.

AzureDeployment/CosmosDB/cosmosdb.json was not valid JSON, so the template could not be parsed or deployed at all:

- The Microsoft.DocumentDB/databaseAccounts resource was missing its closing
  brace, leaving the resource array unparseable.
- A comma was missing between the database and container resources.
- The sqlDatabases and containers resources used the wrong type paths
  (Microsoft.DocumentDB/sqlDatabases and Microsoft.DocumentDB/containers).
  As top-level child resources they need the full parent path
  (Microsoft.DocumentDB/databaseAccounts/sqlDatabases[/containers]) and a
  name prefixed with the parent resource name. The container's dependsOn was
  updated to reference the full database resource name.

Verified: the file now parses as valid JSON and every resource uses the
correct provider type path and parent-prefixed name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant