Share via

Updating the partition key of a cosmos collection

HimanshuSinha 19,637 Reputation points Microsoft Employee Moderator
2026-05-14T06:46:43.7333333+00:00

Hello ,

Can we change the partition key of a container once it is created?

thanks
himanshu

Azure Cosmos DB
Azure Cosmos DB

An Azure NoSQL database service for app development.


Answer accepted by question author

  1. Q&A Assist
    2026-05-14T06:46:52.5433333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    A container’s partition key cannot be changed in place after creation. Partition key values are immutable, and the partition key definition of a container is fixed once created.

    To use a different partition key, data must be moved to a new container that is created with the desired partition key. This can be done using container copy jobs or, in the Azure portal for the NoSQL API, by using the Change partition key experience, which creates or selects a destination container and copies data from the source container.


    References:

    Was this answer helpful?

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.