Migrate your database to SQL Azure

PREREQUISITES: You must have created your SQL server in Azure SQL and have an empty database. For more information, see Quickstart: Create an Azure SQL database in the Azure portal

  1. Configure the Azure SQL firewall.
    To be able to access your Azure SQL database server from your local machine, add a firewall rule for your IP:
    1. Login to the Azure Management Portal and select SQL servers.
    2. In the tree on the left, select your database server.
    3. In the central settings pane, select Firewall.
    4. In the right pane, allow access to the Azure Services.
    5. Copy Your current IP address, displayed beside the Client IP Address, and paste it in the START IP and  END IP range input fields.
    6. Save your changes.
  2. Migrate your local database to Azure SQL.
    If you use SQL Express data file, you must first attach it to a running SQL Server instance.
    1. Download and run the Data migration Assistant.
    2. On the Select Process  step, select Analyze and Migrate » SQL Database.
    3. Provide connection information to your local database.
      No changes to the default settings are required until the script generation is completed on Results Summary screen.
    4. On the next step, provide connection information for your Azure SQL database server.
      In Server, enter the Azure SQL Server fully qualified DNS name.
      The name must have the following format: <yourservername>.database.windows.net.

      You can find the fully qualified DNS name in the following way:

      1. In the Management Portal of Microsoft Azure Platform, click Database.
      2. Select your database instance and expand Properties pane in the right.
      3. The name appears in Fully Qualified DNS Name field.
    5. Select an empty database you have already created for this deployment or create a new one.
      To create a new database, click Create Database button, enter name and size, and confirm.
    6. Click Next and confirm the execution of the previously generated migration SQL script against this database.
    7. When you are finished, click Exit to close the Migration Wizard.
  3. Change the connection string in the DataConfig.config file of your project to point to the Azure SQL instance, where you have migrated your database.
    The format of the connection string element is the following:

    <add dbType="SqlAzure" name="Sitefinity" connectionString="Server=<serverName>.database.windows.net;User ID=<userName>@<serverName>;Password=<password>;Database=<databaseName>; Trusted_Connection=False;Encrypt=True" providerName="System.Data.SqlClient" />

    NOTE: For Sitefinity CMS to function normally with Azure SQL, set the dbType attribute to SqlAzure.

    RECOMMENDATION: We recommend that you keep the Visual Studio solution for future purposes, such as upgrade.

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?

Next article

Deploy the project