Original article: http://azurecoding.net/blogs/brownie/archive/2008/11/21/using-an-existing-sql-instance-with-azure-sdk.aspx
David Justice provided this tip on his blog. but if you already have access to a SQL Server Installation, You're not limited to using SQL Express. you don't even have to use a local SQL installation. just open developmentstorage.exe. config in your azure SDK bin directory and change the two lines that refer to sqlexpress to point to the instance you want.
Also there is a command line parameter for devtablegen that you have to pass in order to get it to generate the tables on an instance other than the default sqlexpress. passing/Server: <myserver [\ myinstancename]> to devtablegen will cause it to generate your table storage on a SQL instance with the same name. in fact, if you're re going to be using the samples with a predetermined SQL instance, you might as well change it so that rundevstore. CMD will generate the tables for you. I did the digging so you don't have. first we want to change the Microsoft. samples. servicehosting. targets file. this file is ultimately responsible for calling devtablegen.
- Insert a line after the opening for the Property Group at the top of the file (line 3)
- Paste these lines into the file
<! -- Allow user to pass the server parameter to devtablegen -->
<Devstoreparam condition = "'$ (InstanceName )'! = ''">/Server: $ (InstanceName) </devstoreparam>
<Devstoreparam condition = "'$ (InstanceName)' ='' "> </devstoreparam>
- Replace the updatesamplestabledb (do a search but shocould be near line 130) with the following
<Target name = "updatesamplestabledb" dependsontargets = "buildsubprojects">
<Message text = "$ (devtablegencommand) $ (devstoreparam)/Database: $ (samplesdbname) $ (devtablegenforcecreateflag) @ (devtablegenassemblies)"/>
<Exec condition = "'$ (samplesdbname )'! = ''"
Command = "$ (devtablegencommand) $ (devstoreparam)/Database: $ (samplesdbname) $ (devtablegenforcecreateflag) @ (devtablegenassemblies )"
Workingdirectory = "$ (msbuildprojectdirectory)"/>
</Target>
What we did here was allow a parameter called InstanceName to be passed into msbuild that will be passed to devtablegen. all we have to do now is update rundevstore. CMD to pass in the parameter. replace line 21 in rundevstore. CMD with the following:
% Msbuild \ buildall. proj/T: rundevstoreonsamplestabledb/P: samplesdbname = servicehostingsdksamples; forcetablecreate = true; InstanceName =.
Replace. at the end with your instance name (unless it's the default instance on local, in that case. is the shortcut for that ). open your windows azure SDK prompt, navigate to your samples directory, execute rundevstore and voila, you 've broken the chains to SQL Express.
What's that you say, too lazy to do all that file opening, cutting and pasting? Have no fear! Here are the sample files for your convenience.
Microsoft.samples.servicehosting.tar gets
Rundevstore. cmd
Published Friday, November 21,200 8 am by Mike Brown
Filed under: Windows Azure, samples, tips and tricks, devstorage