cosmos db fix error vector capability not enabled although it is enabled

Walter 0 Reputation points
2025-04-25T16:34:13.2533333+00:00

Vector search is activated:

azure vector ON

error message:

CosmosHttpResponseError: (BadRequest) Message: {"Errors":["A Container Vector Policy has been provided, but the capability has not been enabled on your account

I have activated it and have waited well over 15min

zone=EU west

    vector_embedding_policy = {
        "vectorEmbeddings": [
            {
                "path":"/Embedding",
                "dataType":"float32",
                "distanceFunction":"cosine",
                "dimensions":1536
            }
        ]
    }

    # Define the indexing policy for the collection
    indexing_policy = {
        "includedPaths": [
            {
                "path": "/*"
            }
        ],
        "excludedPaths": [
            {
                "path": "/\"_etag\"/?"
            }
        ],
        "vectorIndexes": [
            {"path": "/Embedding",
            "type": "diskANN"
            }
        ]
    }

    # Create the product catalog collection
    await database.create_container_if_not_exists(
        id=container_name,
        partition_key=PartitionKey(path='/customer_number'),
        indexing_policy=indexing_policy,
        vector_embedding_policy=vector_embedding_policy,
        offer_throughput=ThroughputProperties(auto_scale_max_throughput=4000))

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,864 questions
{count} votes

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.