Thanks for the question and using MS Q&A platform.
To determine whether the Cosmos DB replica you're accessing through your Azure Synapse Analytics linked service is a read-only replica or a write-enabled replica, there are a few things to consider:
Replica Type in Cosmos DB - Cosmos DB doesn't store the replica type (like ReadOnly or Write) as part of the document data. Instead, this information is part of the Cosmos DB account's region configuration. So, querying the documents directly won’t give you this information.
Check Synapse Linked Service Configuration - When you configure the linked service in Synapse, you can specify preferred regions. These can either be write-enabled or read-only regions.
If your linked service points to a read-only region, then you’re accessing a read-only replica.
If it points to a write-enabled region, you’re working with a write-enabled replica.
To check whether you're connected to a read-only or write-enabled replica, you can use the Azure SDK or the Cosmos DB REST API. These will let you query the Cosmos DB account's region configurations and check if the region you're accessing is set as ReadOnly
or Write
.
Synapse Pipeline Validation - If you’re automating this process in a Synapse pipeline, you can validate the replica type by reviewing the region settings in the linked service configuration. Ensure you are connecting to the correct region type (read-only or write-enabled).
You won’t find a replicaType field in your Cosmos DB documents. Instead, the best way to confirm the replica type is to look at the region configuration in your Cosmos DB account settings. If you're connecting to a read-only region, then you're using a read-only replica. If the region is write-enabled, you're working with a write-enabled replica.
Hope this helps. Do let us know if you have any further queries.
If this answers your query, do click Accept Answer
and Yes
for was this answer helpful. And, if you have any further query do let us know.