Skip to main content

Azure Storage Synchronization between Azure Regions from China and the rest of them

Working with Azure Regions from China is sometimes a little bit more complicated. One of the issues that I encountered is the ability to sync content between different Azure Regions. Inside Azure regions that are in China, things go very smooth.
The challenge appears in the moment when you need to handle data synchronisation between a region from China and a one from Europe, for example. I had this case between China East 2 and North Europe. There is no out of the box, the mechanism to do something like that and you need to handle this synchronisation by yourself.
We will take a look at two different scenarios. A simple one, where is less automation, but the investment is lower, and in 10 minutes you have the sync mechanism in place. The second one is a little more complex, but can be used with success for recurrent activities.

Simple Use Case
For simple scenarios, you should not start to write code by yourself. Take a look at AzCopy that is a command-line tool that enables us to copy content from local machines to Azure Storage or from one Azure Storage to another.
Using Azure Copy, we can run a command line that copy content from one container to another. You can specify what policy you want to use at the moment when content blobs with the same name already exist.
.\azcopy copy 
    'https://rvdemo.blob.core.windows.net/demo/all/*?sv=2019-02-02&ss=bfqt&srt=sco&sp=rwdlacup&se=2019-11-09T21:22:50Z&st=2019-10-30T13:22:50Z&spr=https&sig=9IxJn%2BRYgaBu5R%dsds2BG%2Frf4spjNBxYXagNu7BVx1PT1eTk%1D' 
    'https://rvdemoch.blob.core.chinacloudapi.cn /demo/copy' 
    --overwrite false
In the above example, we just copied content from one location from North Europe to a storage account from China. Don’t forget that the blobs that it is used as a source should be public or you should also include de SAS key (as I have done in the example). By default the overwrite is set to true, meaning that if you already the same content in the destination location, the content is overwritten.
I’ve also done some performance test to see how long it takes to copy content from one location to another. You can see below the output of it.

North Europe     10GB     send to East China           1h52m                  100% success rate             
Japan West         10GB     send to East China           1h01m                  100% success rate
East China           1GB        send to North Europe     0h21m                  100& success rate
East China           1GB        send to Japan West         0h16m                  100& success rate

Automation
For scenarios where you need to be able to repeat the process over and over again, and you want to have better control, I would use Azure Data Factory. It is allowing us to define a pipeline where we would have a copy activity from one Azure Blob to another one. The tricky part here is how to specify the storage from another subscription. Because in Azure Regions location in China you will use a different account and a separate subscription, you are not able to use the Copy Data Tool available inside the Azure Data Factory.
The good part is that we have a connector inside Data Factory that can use a SAS for Azure Blob Storage. The approach would be to run in North Europe the Data Factory Pipeline that would pus the content to the East China location by using the SAS key for access and authorisation.

{
    "name": "AzureBlobStorageLinkedService",
    "properties": {
        "type": "AzureBlobStorage",
        "typeProperties": {
            "sasUri": {
                "type": "SecureString",
                "value": "https://rvdemo.blob.core.windows.net/demo/all/*?sv=2019-02-02&ss=bfqt&srt=sco&sp=rwdlacup&se=2019-11-09T21:22:50Z&st=2019-10-30T13:22:50Z&spr=https&sig=9IxJn%2BRYgaBu5R%dsds2BG%2Frf4spjNBxYXagNu7BVx1PT1eTk%1D'"
            }
        },
        "connectVia": {
            "referenceName": "Linked.....",
            "type": "IntegrationRuntimeReference"
        }
    }
}

To sum up
We can imagine different solutions, using Azure Functions, Azure VMs or Azure Batch, but these two solutions are the one that I used. The first one, based on AzCopy, is simple and can be used with success for a PoC or for cases you you need to move binary content. The one based on Azure Data Factory works with success when you need to do heavy data sync between the two locations.

Comments

Popular posts from this blog

Windows Docker Containers can make WIN32 API calls, use COM and ASP.NET WebForms

After the last post , I received two interesting questions related to Docker and Windows. People were interested if we do Win32 API calls from a Docker container and if there is support for COM. WIN32 Support To test calls to WIN32 API, let’s try to populate SYSTEM_INFO class. [StructLayout(LayoutKind.Sequential)] public struct SYSTEM_INFO { public uint dwOemId; public uint dwPageSize; public uint lpMinimumApplicationAddress; public uint lpMaximumApplicationAddress; public uint dwActiveProcessorMask; public uint dwNumberOfProcessors; public uint dwProcessorType; public uint dwAllocationGranularity; public uint dwProcessorLevel; public uint dwProcessorRevision; } ... [DllImport("kernel32")] static extern void GetSystemInfo(ref SYSTEM_INFO pSI); ... SYSTEM_INFO pSI = new SYSTEM_INFO(

ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded

Today blog post will be started with the following error when running DB tests on the CI machine: threw exception: System.InvalidOperationException: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information. at System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantName) This error happened only on the Continuous Integration machine. On the devs machines, everything has fine. The classic problem – on my machine it’s working. The CI has the following configuration: TeamCity .NET 4.51 EF 6.0.2 VS2013 It see

Navigating Cloud Strategy after Azure Central US Region Outage

 Looking back, July 19, 2024, was challenging for customers using Microsoft Azure or Windows machines. Two major outages affected customers using CrowdStrike Falcon or Microsoft Azure computation resources in the Central US. These two outages affected many people and put many businesses on pause for a few hours or even days. The overlap of these two issues was a nightmare for travellers. In addition to blue screens in the airport terminals, they could not get additional information from the airport website, airline personnel, or the support line because they were affected by the outage in the Central US region or the CrowdStrike outage.   But what happened in reality? A faulty CrowdStrike update affected Windows computers globally, from airports and healthcare to small businesses, affecting over 8.5m computers. Even if the Falson Sensor software defect was identified and a fix deployed shortly after, the recovery took longer. In parallel with CrowdStrike, Microsoft provided a too