Azure / Azure/azure-rest-api-specs

[BUG] Mongo Cluster API should allow `userAssignedIdentities=null` when `identity` is `None`

Open
#38,575 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeSpec
Stars
3.1k
Forks
5.9k
Avg merge
3d 2h
Merged PRs (30d)
424

Description

### API Spec link

https://github.com/Azure/azure-rest-api-specs/blob/1653285537c3f05521c480112d2a36645878c274/specification/mongocluster/resource-manager/Microsoft.DocumentDB/MongoCluster/stable/2025-09-01/mongoCluster.json#L2034

### API Spec version

2025-09-01

### Describe the bug

According to below repro steps, I am trying to update the existing mongo cluster with “identity = None” but service API failed with below error. It seems that the error message indicates that service API doesn’t allow userAssignedIdentities=null when identity is None. Could you take a look this issue. Thanks.

### Expected behavior

The existing mongo cluster should allow userAssignedIdentities=null when identity is None.

### Actual behavior

Service API returns below error while updating the existing mongo cluster with "identity=None" and "userAssignedIdentities=null" is set in the request payload.

### Reproduction Steps

Repro steps:
1. Create mongo cluster without “identity”
```
PUT https://management.azure.com/subscriptions/xx-xx-xx-xx-xx/resourceGroups/acctestRG-xxx/providers/Microsoft.DocumentDB/mongoClusters/acctest-xxx

{
"location": "centralus",
"properties": {
"administrator": {
"password": "xxxx",
"userName": "adminTerraform"
},
"compute": {
"tier": "Free"
},
"createMode": "Default",
"highAvailability": {
"targetMode": "Disabled"
},
"publicNetworkAccess": "Enabled",
"serverVersion": "7.0",
"sharding": {
"shardCount": 1
},
"storage": {
"sizeGb": 32
}
}
}
```

2. Update the existing mongo cluster with “identity = None” and "userAssignedIdentities=null"
```
PUT https://management.azure.com/subscriptions/xx-xx-xx-xx-xx/resourceGroups/acctestRG-xxx/providers/Microsoft.DocumentDB/mongoClusters/acctest-xx

{
"id": "/subscriptions/xx-xx-xxx-xxx-xx/resourceGroups/acctestRG-xx/providers/Microsoft.DocumentDB/mongoClusters/acctest-xxx",
"identity": {
"type": "None",
"userAssignedIdentities": null
},
"location": "centralus",
"name": "acctest-xxx",
"properties": {
"administrator": {
"userName": "adminTerraform"
},
"authConfig": {
"allowedModes": [
"NativeAuth"
]
},
"backup": {
"earliestRestoreTime": "2025-11-03T05:32:28Z"
},
"clusterStatus": "Ready",
"compute": {
"tier": "Free"
},
"connectionString": "xxxxxx",
"createMode": "Default",
"dataApi": {
"mode": "Disabled"
},
"highAvailability": {
"targetMode": "Disabled"
},
"infrastructureVersion": "2.0",
"privateEndpointConnections": [],
"provisioningState": "Succeeded",
"publicNetworkAccess": "Enabled",
"replica": {
"replicationState": "Active",
"role": "Primary"
},
"serverVersion": "7.0",
"sharding": {
"shardCount": 1
},
"storage": {
"sizeGb": 32,
"type": "PremiumSSD"
}
},
"tags": {
"env": "test"
},
"type": "Microsoft.DocumentDB/mongoClusters"
}
```

3. API returns the following error.
```
Error: updating Mongo Cluster (Subscription: "xx-xx-xx-xxx-xx"
Resource Group Name: "acctestRG-xxx"
Mongo Cluster Name: "acctest-xxx"): performing CreateOrUpdate: unexpected status 400 (400 Bad Request) with error: bad_request: Found schema errors for api-version 2025-09-01. Errors: The property '#/identity/userAssignedIdentities' of type null did not match the following type: object in schema xx-xx-xx-xx-xxx
The property '#/identity' of type object did not match one or more of the required schemas. The schema specific errors were:

- anyOf #0:
- The property '#/identity/userAssignedIdentities' of type null did not match the following type: object
- The property '#/identity/type' value "None" did not match one of the following values: UserAssigned
- anyOf #1:
- The property '#/identity' of type object matched the disallowed schema
- The property '#/identity' contained undefined properties: 'userAssignedIdentities'
```

### Environment

PROD

Contributor guide

Open the contributing guide

Research direction

Start at specification/mongocluster/resource-manager/Microsoft.DocumentDB/MongoCluster/stable/2025-09-01/mongoCluster.json around line 2034 and inspect the identity schema. Compare the None and UserAssigned cases with the reproduction payload and service error. Done means the API specification permits userAssignedIdentities=null when identity.type is None, with the schema still rejecting invalid identity combinations.

Written by the indexing model from the issue text.

Assessment

Tech stack
mongodb, openapi
Domain
api, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.