Chris Skorlinski
Microsoft SQL Server Escalation Services

You can use SQL Server Replication technologies to move data between local on premises SQL Server to SQL Server running in Windows Azure Virtual Machines or between Windows Azure Virtual Machines.  Similar to move data between non-trusted corporate domains, keys are 1) use SQL Server Authentication and 2) configure a client alias for the server name.

Run SQL Server Configuration Manager and specify both 32bit and 64bit ALIAS for the SQL Server Subscriber.  For my demo the Publisher and Distributor are the same computer, therefore only Subscriber ALIAS is required.

image

In the ALIAS dialog, use the virtual server name as the ALIAS name and the Server is the Fully Qualified Windows Azure server name that will be your SQL Server Replication Subscriber..  For example:

image

In the examples below I’ve already created a Publication.  I’m now adding a new Replication Subscriber.  In the “Add Subscriber” dialog I provide the ALIAS name as the SQL Server name.

image

Be sure to connect using SQL Server authentication.  For testing, I’ve created a MySQLLogin on the Subscriber as “system administrator”.  Later I can change and tighten down the security as needed.

image

 

If I try to connect using Windows Azure Virtual Server Name “myazuresqlvm.cloudapp.net” I’ll get the error below.

image

 

On the Distribution Agent Security dialog you’ll need to indicate what security accounts Replication should use when making connections.

image

For the Distribution Agent connection properties, I’m specifying SQL Server login for the connection to the Subscriber.

image

On the “Initialize Subscription” properties dialog I cleared the “Initialize” option as I have already ensured the Publisher and Subscriber have identical copies of the database.  I accomplished this by backing up the Publisher database and restoring it on the Subscriber.  This allows me to skip applying the “Snapshot” and simplifies the Replication setup.

image

image

If I wish to generate and apply a Snapshot, I would have to move the Snapshot files to the local Subscriber, then specify the Alternate Snapshot Location property in the Distribution Agent to point to the local copy of the Snapshot files. Clearing the initialize works much easier as long as the data is identical on Publisher and Subscriber..

--Chris Skorlinski