Question

I'll start by saying that I'm fairly new to the idea of deploying applications to the cloud, but I recently downloaded the Azure SDK and wanted to build a sample application to get myself up-to-speed. Here's what I did.

  1. Download the Azure SDK
  2. Create a new solution
  3. Add a new ASP.NET MVC2 Web Role
  4. Compile
  5. Debug

Everything seems to work just fine when I am in debug mode locally--I can create users, log in, and click around. When I deploy my solution, though, I feel like the database is not getting deployed. I understand that SQL Azure works differently from SQL Express, so I have a few questions.

  1. Is the ASP.NET MVC2 Web Role with its accompanying database meant for deployment to Azure?
  2. How can I get my database "into the cloud"?
  3. What is the best way to manage my schema and lookup data for deployment to SQL Azure?

One thing that struck me while I was searching for a solution is that there is not a wealth of good documentation for Azure--all of the tutorials I found are old or targeted at betas. Help!

Edit: The ideal solution to me does not involve opening SQL Server Management Studio to export my schema/data scripts every time I want to deploy. Surely there is a better way than this?

Was it helpful?

Solution 3

I ended up doing some more research and discussing with coworkers. We came to the conclusion that there is no great way to manage databases as one traditionally would, but you can follow the process outlined below.

  • Use SQL Server Management Studio 2008 R2 to connect to SQL Azure
  • Construct your database using a normal SQL Server database project in Visual Studio
  • To export the database to SQL Azure...
    • Deploy the SQL Azure database as a new database
    • Copy your data from the old database to the new database
    • Delete the old database

This is about the best it is going to be for now. You can alternatively use a Data Layer application, which essentially does the same thing.

OTHER TIPS

Deploying to SQL Azure is no different than it would be when you are deploying to a separate SQL Server machine running SQL Server Standard or Enterprise edition. This is different from deploying to a web server that is also running SQL Server Express, that allows you to package an MDF file as part of the ASP.NET app, but that is by design. There are tools available, but you could also script the changes to the database (either by hand or automatically).

Another possible way of automating the deployment is by leveraging the SQL Azure migration wizard, but that will still require a bit of setting up (it is more geared towards 1-time-only migrations).

I highly recommend you develop under local SQL server and deploy your changes to Azure via Red Gate tools: v9 beta of the SQL Compare and Data Compare. They are "most excellent" in this regard.

Also, keep an eye on this free tool: http://www.microsoft.com/en-us/sqlazure/datasync.aspx It promises to do a data-sync between local and Azure versions of a SQL database.

Hope this helps

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top