So you have an existing ASP.NET website and want to move it into Windows Azure … this can be done in a few simple steps using out of the out of the box tools supplied with the Windows Azure SDK.
To illustrate the point I have just created a simple MVC 3.0 site using Razor and .NET 4.0, which can be seen here running in the local ASP.NET development Server.
Once I have made any changes to the site that I wanted I publish the website to a local folder, these are the files that you would normally push to your server to deploy the site. However, now that they are published we can used them and “Cloud-ify” the site into a package to be deployed in Azure.
Once we have the site ready to be published we need to create a Service Definition file which will allow the Windows Azure fabric to know the structure and configuration of our cloud web site when used with the cloud configuration file (generated next).
Along with this Service Definition file we need to add one other file manually to tell the cspack tool that we are going to be packaging a .NET 4.0 application (if this is not done there will be tears).
We now have a “published” website locally, a ServiceDefinition.csdef and a Props.txt file (containing the line TargetFrameWorkVersion=v4.0).
Now we can run the following command using cspack.exe, a command line tool supplied with the Windows Azure SDK to generate a local package to be used with the devfabric:
Then use the csrun.exe command line tool to launch the devfabric and a browser for the site to be displayed and prove that we have the site running locally:
Finally we can then run cspack.exe again without the /copyOnly command and altering the /out variable to generate a Windows Azure cloud service package (cspkg) to be put into the public cloud.