{"id":11304,"date":"2025-11-20T08:00:33","date_gmt":"2025-11-20T16:00:33","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cosmosdb\/?p=11304"},"modified":"2025-11-17T22:19:20","modified_gmt":"2025-11-18T06:19:20","slug":"announcing-online-copy-jobs-in-azure-cosmos-db-migrate-data-with-minimal-downtime","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cosmosdb\/announcing-online-copy-jobs-in-azure-cosmos-db-migrate-data-with-minimal-downtime\/","title":{"rendered":"Announcing Preview of Online Copy Jobs in Azure Cosmos DB: Migrate Data with Minimal Downtime!"},"content":{"rendered":"<p>We are excited to announce the preview of Online Copy Jobs, a powerful new feature designed to make data migration between containers seamless and efficient with minimal downtime. With this feature, you can replicate data from a source to a destination container in real time without disrupting your applications.<\/p>\n<h1>What is an online copy job?<\/h1>\n<p>Online Copy Jobs allow you to copy data from a source container to a destination container while your applications continue to run on the source. All data including incremental updates is automatically replicated, ensuring the destination container becomes an up-to-date replica.<\/p>\n<p>Once the copy is complete, you simply stop updates to the source, point your applications to the destination, and call the completion API. This final step applies any remaining changes and deallocates resources, wrapping up migration with minimal downtime during switchover.<\/p>\n<h2>How does it work?<\/h2>\n<p>1. <strong>Automated Server-Side Resources<\/strong>: Azure Cosmos DB allocates compute resources to run copy jobs.<\/p>\n<p>2. <strong>Change Feed Replication<\/strong>: Online Copy Jobs use the \u201c<a href=\"https:\/\/learn.microsoft.com\/en-us\/azure\/cosmos-db\/nosql\/change-feed-modes?tabs=all-versions-and-deletes%23all-versions-and-deletes-change-feed-mode-preview%20\">all version and delete change feed mode<\/a>\u201d to capture and replicate every update from the source container.<\/p>\n<p>3. <strong>Smart Resource Management<\/strong>: After completion, resources are automatically deallocated to optimize costs.<\/p>\n<h2>Getting started with online copy<\/h2>\n<p>Before you begin, make sure your environment meets these prerequisites:<\/p>\n<ul>\n<li>Use the <a href=\"https:\/\/learn.microsoft.com\/cli\/azure\/\">latest version of Azure CLI<\/a> to manage and monitor copy jobs.<\/li>\n<li>Enable <a href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/continuous-backup-restore-introduction\">continuous backup<\/a> on the source account.<\/li>\n<li>Enable\u00a0<a href=\"https:\/\/learn.microsoft.com\/en-us\/azure\/cosmos-db\/nosql\/change-feed-modes?tabs=all-versions-and-deletes#get-started\">All version and delete change feed mode (preview)<\/a>\u00a0preview feature on the source account.<\/li>\n<li>Enable Online container copy using Azure CLI.<\/li>\n<\/ul>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\"># Set shell variables.\r\n$resourceGroupName = &lt;azure_resource_group&gt;\r\n$accountName = &lt;azure_cosmos_db_account_name&gt;\r\n$EnableOnlineContainerCopy = \"EnableOnlineContainerCopy\"\r\n\r\n# List down existing capabilities of your account.\r\n$cosmosdb = az cosmosdb show \\\r\n--resource-group $resourceGroupName \\\r\n--name $accountName\r\n$capabilities = (($cosmosdb | ConvertFrom-Json).capabilities)\r\n\r\n# Append EnableOnlineContainerCopy capability in the list of capabilities.\r\n$capabilitiesToAdd = @()\r\nforeach ($item in $capabilities) {\r\n$capabilitiesToAdd += $item.name\r\n}\r\n$capabilitiesToAdd += $EnableOnlineContainerCopy\r\n\r\n# Update Cosmos DB account\r\naz cosmosdb update --capabilities $capabilitiesToAdd \\\r\n-n $accountName -g $resourceGroupName<\/code><\/pre>\n<h2>Running an online copy job<\/h2>\n<h3>Using Azure CLI<\/h3>\n<ol>\n<li><strong>Set Up Environment Variables<\/strong>: Define source and destination parameters.<\/li>\n<\/ol>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">$sourceSubId = \"&lt;source-subscription-id&gt;\"\r\n$destinationSubId = \"&lt;destination-subscription-id&gt;\"\r\n$sourceAccountRG = \"&lt;source-resource-group-name&gt;\"<\/code><\/pre>\n<p>2. <strong>Assign Permissions<\/strong>: Grant read permissions on the source account using a managed identity.<\/p>\n<p>3. <strong>Create the Copy Job<\/strong>: Run the following command to create the copy job<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">az cosmosdb copy create --resource-group $destinationAccountRG --job-name $jobName --dest-account $destinationAccount<\/code><\/pre>\n<p>4. <strong>Monitor Job Progress<\/strong>: Use Azure CLI or the portal to track status.<\/p>\n<pre><code class=\"language-default\">az cosmosdb copy show --resource-group $destinationAccountRG --job-name $jobName --dest-account $destinationAccount<\/code><\/pre>\n<p>Key metrics:<\/p>\n<ul>\n<li><strong>Total Count<\/strong>: Total documents in source.<\/li>\n<li><strong>Processed Count<\/strong>: Changes processed from the change feed.<\/li>\n<\/ul>\n<p>5. <strong>Complete the Job<\/strong>: Once all data is copied to the destination container, update your applications to use the destination container and then call the completion API. This crucial step ensures any remaining changes are drained from the source to the destination and deallocates resources, concluding the migration process with minimal downtime.<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">az cosmosdb copy complete --resource-group $destinationAccountRG --account-name $destinationAccount --job-name $jobName<\/code><\/pre>\n<h2>Monitor with Ease<\/h2>\n<p>In the Azure portal, view progress in the <strong>Copy Job listing page<\/strong> with completion percentage.<\/p>\n<p><img decoding=\"async\" width=\"1630\" height=\"418\" class=\"wp-image-11307\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2025\/11\/a-screenshot-of-a-computer-ai-generated-content-m-2.png\" alt=\"A screenshot of a computer AI-generated content may be incorrect.\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2025\/11\/a-screenshot-of-a-computer-ai-generated-content-m-2.png 1630w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2025\/11\/a-screenshot-of-a-computer-ai-generated-content-m-2-300x77.png 300w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2025\/11\/a-screenshot-of-a-computer-ai-generated-content-m-2-1024x263.png 1024w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2025\/11\/a-screenshot-of-a-computer-ai-generated-content-m-2-768x197.png 768w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2025\/11\/a-screenshot-of-a-computer-ai-generated-content-m-2-1536x394.png 1536w\" sizes=\"(max-width: 1630px) 100vw, 1630px\" \/><\/p>\n<p>Using CLI, the show command provides real-time updates.<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">az cosmosdb copy show --resource-group $destinationAccountRG --account-name $destinationAccount --job-name $jobName<\/code><\/pre>\n<h2>Get Started Today<\/h2>\n<p>Start leveraging the power of Online Copy Jobs in Azure Cosmos DB to seamlessly scale, optimize, and manage your data with minimal downtime. Whether expanding your data strategy, improving disaster recovery, or creating an isolated analytics container, Online Copy Jobs will help you achieve it efficiently.<\/p>\n<p>For more information, explore the <a href=\"https:\/\/learn.microsoft.com\/en-us\/azure\/cosmos-db\/container-copy\" target=\"_new\">Azure Cosmos DB documentation on Online Container Copy<\/a> and start your journey toward hassle-free data migration today!<\/p>\n<h2><b><span data-contrast=\"none\">Leave a review<\/span><\/b><span data-contrast=\"none\">\u202f<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/h2>\n<p><span data-contrast=\"auto\">Tell us about your Azure Cosmos DB experience! Leave a review on\u202fPeerSpot\u202fand\u202fwe\u2019ll\u202fgift\u202fyou $50.\u202f<\/span><a href=\"https:\/\/peerspotdotcom.my.site.com\/proReviews\/?SalesOpportunityProduct=00kPy000004TKXJIA4&amp;productPeerspotNumber=30881&amp;CalendlyAccount=peerspot&amp;CalendlyFormLink=peerspot-product-reviews-ps-gc-vi-sf-50&amp;giftCard=50\"><span data-contrast=\"none\">Get started here<\/span><\/a><span data-contrast=\"auto\">.\u202f<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;201341983&quot;:0,&quot;335559738&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<h2><b><span data-contrast=\"none\">About Azure Cosmos DB<\/span><\/b><span data-contrast=\"none\">\u202f<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;201341983&quot;:0,&quot;335559738&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/h2>\n<p><span data-contrast=\"auto\">Azure Cosmos DB is a fully managed and serverless NoSQL and vector database for modern app development, including AI applications. With its SLA-backed speed and availability as well as instant dynamic scalability, it is ideal for real-time NoSQL and MongoDB applications that require high performance and distributed computing over massive volumes of NoSQL and vector data.\u202f<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;201341983&quot;:0,&quot;335559738&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">To stay in the loop on Azure Cosmos DB updates, follow us on\u202f<\/span><a href=\"https:\/\/twitter.com\/AzureCosmosDB\"><span data-contrast=\"none\">X<\/span><\/a><span data-contrast=\"auto\">,\u202f<\/span><a href=\"https:\/\/aka.ms\/AzureCosmosDBYouTube\"><span data-contrast=\"none\">YouTube<\/span><\/a><span data-contrast=\"auto\">, and\u202f<\/span><a href=\"https:\/\/www.linkedin.com\/company\/azure-cosmos-db\/\"><span data-contrast=\"none\">LinkedIn<\/span><\/a><span data-contrast=\"auto\">.\u202f<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;201341983&quot;:0,&quot;335559738&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We are excited to announce the preview of Online Copy Jobs, a powerful new feature designed to make data migration between containers seamless and efficient with minimal downtime. With this feature, you can replicate data from a source to a destination container in real time without disrupting your applications. What is an online copy job? [&hellip;]<\/p>\n","protected":false},"author":90111,"featured_media":11308,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[14],"tags":[],"class_list":["post-11304","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-core-sql-api"],"acf":[],"blog_post_summary":"<p>We are excited to announce the preview of Online Copy Jobs, a powerful new feature designed to make data migration between containers seamless and efficient with minimal downtime. With this feature, you can replicate data from a source to a destination container in real time without disrupting your applications. What is an online copy job? [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/11304","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/users\/90111"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/comments?post=11304"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/11304\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media\/11308"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media?parent=11304"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/categories?post=11304"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/tags?post=11304"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}