[Cosmos DB Account]: location should be required but it's not; properties.locations shouldn't be required, but it is
- Dominant language
- TypeScript
- Stars
- 108
- Forks
- 44
- Avg merge
- 18h 53m
- Merged PRs (30d)
- 29
Description
### Resource Type
Microsoft.DocumentDB/databaseAccounts
### Api Version
2024-05-15
### Issue Type
Other
### Other Notes
If you write:
```
var cosnoLocation = resourceGroup().location
resource cosno 'Microsoft.DocumentDB/databaseAccounts@2024-05-15' = {
name: 'cosno-repro-dev-${cosnoLocation}-repro'
properties: {
databaseAccountOfferType: 'Standard'
}
}
```
... you get '_The specified "object" declaration is missing the following required properties: "locations"._' on `properties`.
If you change it for:
```
var cosnoLocation = resourceGroup().location
resource cosno 'Microsoft.DocumentDB/databaseAccounts@2024-05-15' = {
name: 'cosno-repro-dev-${cosnoLocation}-repro'
properties: {
databaseAccountOfferType: 'Standard'
locations: [
{
failoverPriority: 0
locationName: resourceGroup().location
}
]
}
}
```
... you get no warnings, but deployment fails. If, however, you try with:
```
var cosnoLocation = resourceGroup().location
resource cosno 'Microsoft.DocumentDB/databaseAccounts@2024-05-15' = {
name: 'cosno-repro-dev-${cosnoLocation}-repro'
location: cosnoLocation
properties: {
databaseAccountOfferType: 'Standard'
}
}
```
... you get the warning again, but deployment succeeds in Azure.
My conclusion: `location` should be required but it's not; `properties.locations` shouldn't be required, but it is. The documentation seems to be inverted with respect to what happens in practice.
### Bicep Repro
```
var cosnoLocation = resourceGroup().location
resource cosno 'Microsoft.DocumentDB/databaseAccounts@2024-05-15' = {
name: 'cosno-repro-dev-${cosnoLocation}-repro'
location: cosnoLocation
properties: {
databaseAccountOfferType: 'Standard'
// locations: [
// {
// failoverPriority: 0
// locationName: resourceGroup().location
// }
// ]
}
}
```
### Confirm
- [X] I have read the troubleshooting guide and looked for duplicates.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the Microsoft.DocumentDB/databaseAccounts type definition for API version 2024-05-15 in this repository and inspect the required properties for the resource and its properties object. Compare those declarations with the Bicep repro and the reported deployment behavior; done means the schema's requiredness matches the observed Azure behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, typescript
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100