AZ-303 Exam QuestionsBrowse all questions from this exam

AZ-303 Exam - Question 36


You have an Azure Cosmos DB account named Account1. Account1 includes a database named DB1 that contains a container named Container1. The partition key for Container1 is set to /city.

You plan to change the partition key for Container1.

What should you do first?

Show Answer
Correct Answer: B

To change the partition key for an Azure Cosmos DB container, you must create a new container with the desired partition key because it is not possible to update the partition key of an existing container directly. Once the new container is created, you can migrate the data from the existing container to the new one and make the necessary application changes to utilize the new partition key.

Discussion

16 comments
Sign in to comment
czarul79
Jan 24, 2021

Warning ! on exam303 - Microsoft change the anwer since 18th january 2021 and removed option: B. Create a new container in DB1. NOW ! new B is option => "Create a new Azure Cosmos DB account" Propably there were to many mistakes , so go for new comments from HERE pos

kuroro
Apr 1, 2021

Is new B the correct answer?

Moyuihftg
May 17, 2021

Yes it is

Moyuihftg
May 17, 2021

Yes it is

anandpsg101
Dec 3, 2020

we need to create new container with new partition. and move the data from old container and delete the old container.

xAlx
Dec 2, 2020

Correct You cannot update partition key, need to create new container and re-populate data

AKumar
Mar 18, 2021

was in the exam, New option in place B="Create a new Azure Cosmos DB account"

azurellc
May 16, 2021

On exam 5/15/2021

nfett
May 26, 2021

refer to "Choosing a partition key" from https://docs.microsoft.com/en-us/azure/cosmos-db/partitioning-overview#choose-partitionkey B is the right answer for this.

syu31svc
Aug 28, 2021

Technically, it is not possible to “update” your partition key in an existing container. So, create new container with new partition key and move the data from old container and then delete the old container. https://devblogs.microsoft.com/cosmosdb/how-to-change-your-partition-key/ B is correct

azurecert2021
Jan 12, 2021

it looks like DB account and DB can be same only source and destination collection container should be different as shown in dev blog screenshot. but we can not delete the container1 as we have to migrate the data or copy from it , other options are totally irrelevant hence give option is correct "creating a new Cosmo DB account" it can be same of different so given answer is correct and justification mentioned is from dev blog from Theo who is Program Manager, Azure Cosmos DB same as Q63 only options are different there correct option is "Create a new Azure Cosmos DB account." similar question in 300 dumps except correct option is different Create a new container in DB1. rest of the option was same as this question

levo017
Feb 11, 2021

Thank you ~

azurecert2021
Jan 12, 2021

There are 2 site 1) microsoft site https://docs.microsoft.com/en-us/azure/cosmos-db/partitioning-overview Selecting your partition key is a simple but important design choice in Azure Cosmos DB. Once you select your partition key, it is not possible to change it in-place. If you need to change your partition key, you should move your data to a new container with your new desired partition key.

Stevezzc
Jan 24, 2021

Correct. Once you select your partition key, it is not possible to change it in-place. If you need to change your partition key, you should move your data to a new container with your new desired partition key. see also: https://docs.microsoft.com/en-us/azure/cosmos-db/partitioning-overview#choose-partitionkey

Amit3
Jun 11, 2021

On Exam 11-Jun-21, Answer is correct.

MadhaviSalunkhe
Dec 3, 2020

Given answer is correct. No need to delete container1 as per given documents

kaunhe
Apr 25, 2021

like czarul says" "on exam303 - Microsoft change the answer since 18th january 2021 and removed option: B. Create a new container in DB1. NOW ! new B is option => "Create a new Azure Cosmos DB account"

JayBee65
Jan 31, 2022

Are you saying that the new answer B is correct? I think you are, but it's not clear from your post.

VivekSood
Apr 26, 2021

So as per new MS option. What is the right answer? is it still option 'B' Create a new Azure Cosmos DB account ?

Suseel
Dec 2, 2020

Answer should be A

Jindrich
Feb 20, 2021

So you lose all your data? Would not be better to create a new container first, define the new partition and then move the data and then delete the container?

azurecert2021
Jan 12, 2021

2) dev blog from Theo who is Program Manager, Azure Cosmos DB =>https://devblogs.microsoft.com/cosmosdb/how-to-change-your-partition-key/ The good news is that there are two features, the Change Feed Processor and Bulk Executor Library, in Azure Cosmos DB that can be leveraged to achieve a live migration of your data from one container to another. This allows you to re-distribute your data to match the desired new partition key scheme, and make the relevant application changes afterwards, thus achieving the effect of “updating your partition key”. You will need to have access to an Azure subscription, and an Azure Cosmos DB SQL API account that will be used for the migration metadata (this can be the same as the collection where you wish to change partition key scheme, if you wish). The deployment uses Azure Resource Manager (ARM) to deploy two app service plans. One is for a client node.js application, and the other is to handle the migration workload and Change Feed processing.