Azure / Azure/bicep-types-az

Unable to parse request payload when creating services on Microsoft.DocumentDB/databaseAccounts

Open
#2,167 6 comments 0 reactions 0 assignees View on GitHub
Needs: Triage :mag:
Dominant language
TypeScript
Stars
108
Forks
44
Avg merge
18h 53m
Merged PRs (30d)
29

Description

**Bicep version**
Bicep CLI version 0.27.1 (4b41cb6d4b)

**Describe the bug**
When trying to create a `services` child resource on `Microsoft.DocumentDB/databaseAccounts@2024-02-15-preview` it gives me the error that the payload cannot be parsed.

https://learn.microsoft.com/en-us/azure/templates/microsoft.documentdb/2024-02-15-preview/databaseaccounts/services?pivots=deployment-language-bicep#resource-format

**To Reproduce**

```bicep
param cosmosAccountName string
param enableDedicatedGateway bool

resource cosmosAccount 'Microsoft.DocumentDB/databaseAccounts@2024-02-15-preview' = {
name: cosmosAccountName
location: location
kind: 'GlobalDocumentDB'
tags: {
defaultExperience: 'Core (SQL)'
'hidden-cosmos-mmspecial': ''
}
properties: {
publicNetworkAccess: 'Enabled'
enableAutomaticFailover: false
enableMultipleWriteLocations: false
isVirtualNetworkFilterEnabled: false
virtualNetworkRules: []
disableKeyBasedMetadataWriteAccess: false
enableFreeTier: false
enableAnalyticalStorage: false
analyticalStorageConfiguration: {
schemaType: 'WellDefined'
}
databaseAccountOfferType: 'Standard'
enableMaterializedViews: false
defaultIdentity: 'FirstPartyIdentity'
networkAclBypass: 'None'
disableLocalAuth: false
enablePartitionMerge: false
enablePerRegionPerPartitionAutoscale: false
enableBurstCapacity: false
enablePriorityBasedExecution: false
minimalTlsVersion: 'Tls12'
consistencyPolicy: {
defaultConsistencyLevel: 'Session'
maxIntervalInSeconds: 5
maxStalenessPrefix: 100
}
locations: [
{
locationName: 'West Europe'
failoverPriority: 0
isZoneRedundant: false
}
]
cors: []
capabilities: [
{
name: 'EnableServerless'
}
]
ipRules: []
backupPolicy: {
type: 'Periodic'
periodicModeProperties: {
backupIntervalInMinutes: 240
backupRetentionIntervalInHours: 8
backupStorageRedundancy: 'Geo'
}
}
networkAclBypassResourceIds: []
diagnosticLogSettings: {
enableFullTextQuery: 'None'
}
capacity: {
totalThroughputLimit: 4000
}
}

resource dedicatedGateway 'services' = if (enableDedicatedGateway) {
name: 'gateway'
properties: {
instanceCount: 1
instanceSize: 'Cosmos.D4s'
}
}
}
```

**Additional context**

This is being deployed to an existing cosmos db that does not yet have a dedicated gateway.

Error from Azure Portal deployments on the resource group:

```json
{
"code": "DeploymentFailed",
"target": "/subscriptions/xxxx/resourceGroups/dev-rg/providers/Microsoft.Resources/deployments/cosmosDb",
"message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.",
"details": [
{
"code": "BadRequest",
"target": "/subscriptions/xxxx/resourceGroups/dev-rg/providers/Microsoft.DocumentDB/databaseAccounts/dev-cosmos/services/gateway",
"message": "Unable to parse request payload. \r\nActivityId: 74d83e42-8fde-4de4-86df-a01a967e3b63, Microsoft.Azure.Documents.Common/2.14.0"
}
]
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the Bicep deployment from the issue against Microsoft.DocumentDB/databaseAccounts@2024-02-15-preview and inspect the generated services/gateway request. The payload names no repository file or test; done means the documented services child resource deploys successfully without an "Unable to parse request payload" error.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, typescript
Domain
cloud, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.