How Azure Can Help Your Company Expand In Multiple Regions (2 Of 5)

In my previous article, we created a proposal based on the company’s overview, goals, and technology, then highlighted the benefits of an architecture base don Azure resources and gave an overview of its flow. In today’s article, I am going to start guiding you by implementing the proposed architecture by creating an Azure SQL database resource in our main company’s database in Montana, replicating it in Europe, and then synchronizing it with the On-Premises database.

How Azure can help your company expand in multiple regions

Create an Azure SQL Database

Sign in to the Azure portal.

Select + Create a resource, filter the result for Databases, and click on SQL Database.

How Azure can help your company expand in multiple regions

On the creation tab, select a resource group, insert a database name, create a new server in a Central US (primary location of the company), and select a database’s configuration.

How Azure can help your company expand in multiple regions

Click Review + create to create the Azure SQL database resource.

Replicate the database

Once the creation process is completed, select your SQL server, and click your SQL database from the list of available databases.

How Azure can help your company expand in multiple regions

Select the Geo-Replication tab and click North Europe (closest region to the company’s target audience).

How Azure can help your company expand in multiple regions

In the creation form, create a new server in North Europe, select the same configuration as the primary location, and click OK.

How Azure can help your company expand in multiple regions

Azure will then initialize the new instance and then seed the data from the primary database to your replica.

How Azure can help your company expand in multiple regions

Synchronize your On-Premise database to Azure SQL database

Select your primary SQL database from the list of available databases.

Click the Sync to other databases tab and click New Sync Group.

How Azure can help your company expand in multiple regions

On the creation tab, insert a group name, select the Existing database and enable the automatic synchronization. By doing so, you will set the frequency with which the primary instance of your Azure SQL database will synchronize with the group and resolve possible conflicts. The possible options are,

  1. Hub win: When conflicts occur, data in the hub database overwrite conflicting data in the member database.
  2. Member win: When conflicts occur, data in the member database overwrite conflicting data in the hub database.

How Azure can help your company expand in multiple regions

Once the synchronization for the group is created, you will see it in the status column, Not Ready.

How Azure can help your company expand in multiple regions

Select the synchronization group, click databases, and then click the Add an On-Premises Database button.

How Azure can help your company expand in multiple regions

To complete the configuration of an On-Premises database, we must set up an SQL Azure Data Sync agent on the machine where the SQL server is located and then Select which Database to sync.

Set up the SQL Azure Data Sync Agent

  • Click Choose the sync Agent Gateway.
  • If you don’t have an agent already installed on your machine, select the Create a new agent radio button.

    How Azure can help your company expand in multiple regions
     
  • Download the data sync agent from this link.
  • Open the installer and start the installation wizard.

    How Azure can help your company expand in multiple regions
     
  • Read and accept the License Agreement and Privacy Information, select Accept and click Next.
  • Enter the credential of the account with Network Access to run Windows Service (for example, contoso\gtrekter) and click Next.

    How Azure can help your company expand in multiple regions
     
  • Enter the location where you want to install the agent and click Next to start the installation.
  • Once the installation is complete, launch the Microsoft SQL Data Sync Agent.
  • Before continuing, go back to Azure, fill the agent name textbox, and click Create and Generate Key button.
  • Once the key is generated, copy it to the clipboard.

    How Azure can help your company expand in multiple regions
     
  • In the Microsoft SQL Data Sync, click the Submit Agent Key button.

    How Azure can help your company expand in multiple regions
     
  • In the configuration window, add the Agent Key generated by Azure and the Login and Password fields. Enter the Azure SQL Database server’s credentials where the Hub database is located.

    How Azure can help your company expand in multiple regions
     
  • Test that everything is working properly by clicking on the Test Connection button and then OK.
  • Click the Register button, and in the SQL Server Configuration window, select the Authentication type, the Server, and the Database to synchronize.

    How Azure can help your company expand in multiple regions
     
  • Once again, check that everything is fine by clicking on the Test Connection button and Save.

Select the database

To complete the configuration of your On-Premises database, follow the following steps,

Step 1

Click select the database.

Step 2

The tab that will appear, add a Sync Member Name, select the On-premises database that you have previously registered in the Microsoft SQL Data Sync and select the Sync Directions. The available options are,

  1. Bi-directional Sync: Data changes on either the on-premises SQL Server database or the hub database will be written to the other database.
  2. To the Hub: Changes in the on-premises SQL Server database are written to the hub database but not vice versa.
  3. From the Hub: Changes in the hub are written to the on-premises SQL Server, but not vice versa.

    How Azure can help your company expand in multiple regions

Step 3

Click OK

Congratulations! You have successfully created an Azure SQL database resource, geo-replicated it in a secondary location, and synchronized it with your On-Premises database!