When trying to enable the capability "EnableUniqueIndexReIndex", it always give the error message "Invalid capability EnableUniqueIndexReIndex"

Haroldo Júnio 0 Reputation points
2024-09-10T12:47:16.21+00:00

When I try to enable the capability "EnableUniqueIndexReIndex", I always get the error message "Invalid capability EnableUniqueIndexReIndex".

I tried with the az cli and with the bicep script that deploys the application. I have installed the cosmosdb az extension in the preview version.

$ az extension add --name cosmosdb-preview --allow-preview true
Extension 'cosmosdb-preview' 1.0.1 is already installed.

$ az cosmosdb update --resource-group <rg> --name <dbacc> --capabilities EnableMongo EnableServerless EnableUniqueIndexReIndex
The behavior of this command has been altered by the following extension: cosmosdb-preview (BadRequest) Invalid capability EnableUniqueIndexReIndex. ActivityId: <id>, Microsoft.Azure.Documents.Common/2.14.0 Code: BadRequest Message: Invalid capability EnableUniqueIndexReIndex. ActivityId: <id>, Microsoft.Azure.Documents.Common/2.14.0

When deploying with the bicep code:

resource dbacc 'Microsoft.DocumentDB/databaseAccounts@2024-05-15' = {
  name: parNomeDBACC
  location: parLocal
  kind: 'MongoDB'
  properties: {
    consistencyPolicy: {
      defaultConsistencyLevel: 'Eventual'
    }
    locations: [
      {
        locationName: parLocal
        failoverPriority: 0
        isZoneRedundant: false
      }
    ]
    databaseAccountOfferType: 'Standard'
    apiProperties: {
      serverVersion: '4.2'
    }
    capabilities: [
      {
        name: 'EnableServerless'
      }
      {
        name: 'EnableUniqueIndexReIndex'
      }
    ]
  }
  tags: {
    componente: 'database'
    regiao: parLocal
    projeto: parNomeProjeto
  }
}

It gives as the result:

{"status":"Failed","error":{"code":"DeploymentFailed","target":"/subscriptions/<id>/providers/Microsoft.Resources/deployments/criaDev","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":"ResourceDeploymentFailure","target":"/subscriptions/<id>/resourceGroups/<rg>/providers/Microsoft.Resources/deployments/criaDatabaseAccount","message":"The resource write operation failed to complete successfully, because it reached terminal provisioning state 'Failed'.","details":[{"code":"DeploymentFailed","target":"/subscriptions/<id>/resourceGroups/<rg>/providers/Microsoft.Resources/deployments/criaDatabaseAccount","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/<id>/resourceGroups/<rg>/providers/Microsoft.DocumentDB/databaseAccounts/dbaccruraltechgeosyncdev","message":"{\r\n  \"code\": \"BadRequest\",\r\n  \"message\": \"Invalid capability EnableUniqueIndexReIndex.\\r\\nActivityId: <id>, Microsoft.Azure.Documents.Common/2.14.0\"\r\n}"}]}]}]}}

My versions are:

$ az version --output table
Azure-cli    Azure-cli-core    Azure-cli-telemetry
-----------  ----------------  ---------------------
2.64.0       2.64.0            1.1.0
$ az extension show --name cosmosdb-preview --output table
ExtensionType    Name              Path                                                 Version
---------------  ----------------  ---------------------------------------------------  ---------
whl              cosmosdb-preview  /home/haroldo/.azure/cliextensions/cosmosdb-preview  1.0.1
Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,631 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Oury Ba-MSFT 19,101 Reputation points Microsoft Employee
    2024-09-10T22:32:32.6433333+00:00

    @Haroldo Júnio Thank you for reaching out.

    It seems you’re encountering an issue with enabling the “EnableUniqueIndexReIndex” capability in Azure Cosmos DB for MongoDB.

    Please note that capability "EnableUniqueIndexReIndex" cannot be enable on Azure Cosmos DB mongo DB RU configured with continuous back up. Please check if you Azure Cosmos db is configured as periodic or continuous back up.

    User's image

    Do also if you are using the right command. Please see more details on the doc.

    https://video2.skills-academy.com/en-us/azure/cosmos-db/mongodb/how-to-configure-capabilities

    Regards,

    Oury


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.