Connecting to a database hosted on Azure
Published 10 August 2016
Upon creating your database project, ReadyRoll allows you to import an existing database from an Azure instance.
Once the baseline script is created, you can then configure your project for deployment to Azure by ensuring that the following settings are configured in your database project:
- Target platform should be set to either Microsoft Azure SQL Database or Microsoft Azure SQL Database v12 . This ensures that the deployment package produced during the build process is compatible with Azure.
Shadow database should be deployed to a local instance of SQL Server, if you would like to take advantage of ReadyRoll's automated migration script generation (i.e. using the ReadyRoll tool-window). This is configured by checking the following option on the Debug tab: Always use default connection string for Shadow database.
This will cause the Shadow database to be deployed to the connection displayed in the Default Connection String box, typically (localdb)\ProjectsV13. If you could like to deploy the Shadow database to a different server, see Setting the Shadow connection string within the following article: Target and shadow databases.
- Target connection string should be set to your Azure instance/database. Click Edit to display the connection dialog, and Browse to your Azure subscription to pre-fill the connection details.
After adjusting the above project settings, perform a build of your ReadyRoll solution to ensure that the changes take effect.
You'll then be able to import your database and generate a baseline migration. After your database is imported, you may find it preferable to change your target connection string to an on-premise instance of SQL Server for editing/script generation, and deploy to your Azure database separately (e.g. using PowerShell or VSTS).