Log in to like this post! Migrating Windows Phone 7 Applications to Windows Azure [Infragistics] Mihail Mateev / Friday, April 15, 2011 Very often, developers are asking - how to migrate a Windows Phone 7 application to Windows Azure (data and server-side applications). The answer is - the migration to Windows Azure is very easy when you observe certain rules.This article will show you how to do from an existing Windows Phone 7 administration system to enjoy benefits of Windows Azure. Sample Application Requirements: Software: Visual Studio 2010 Windows Phone Developer Tools Windows Phone 7 Toolkit Data Connector project in codeplex App.config for WP7 applications Sample application from article Creating Bing Maps Tile-Layers in Windows Phone 7. Steps to reproduce Create a new SQL Azure database Migrate a sample database – SampleGeographyData from Local SQL Server to SQL Azure Create a new Windows Azure Storage Account and a Hosted Service Add a Web Role project in Solution Edit Windows Phone Application Configuration Settings Publish the Windows Azure Cloud Service: Create a new SQL Azure database Set firewall rules: In order to access the new SQL Azure server outside the Windows Azure Platform Management Portal, you must specify one or more firewall rules. The checkbox labeled Allow other Windows Azure services to access this server should be checked if you want to allow other Windows Azure services and applications to access your SQL Azure Server. To access your database outside Windows Azure you need to create Firewall rules by setting the range such that your IP address is in that range. Than you should be able to connect to SQL Azure Database from your computer using SQL Server Management Studio, SQL Azure Migration Wizard or a custom client. To test the connection select a database from database tab and click on Test connectivity. Migrate a sample database – SampleGeographyData from Local SQL Server to SQL Azure To work migration wizard properly need to set TargetUserName with user@ServerName format: <add key="TargetUserName" value="DatabaseUser@MyDatabaseServerName"/> Start the SQL Azure Migration Wizard Confirm source SQL Server and database Select objects that you want to import. Ensure that from "Advanced” options for “Script Table / Data” is selected “Table Schema with Data” option Wait until script generation is finished. Connect to SQL Azure Confirm target database. Wait until import is finished. Connect to SQL Azure database using SQL Server Management Studio and select all from [dbo].[countries] table. Create a new Windows Azure Storage Account and a Hosted Service Create a new Storage Account Create a new Hosted Service Add a Web Role project in Solution Add a new Windows Azure project to the solution Add Web Role Project in solution. Select TileWcfService to be used for this web role. A TileWcfService project appears in the web roles list. Edit Windows Phone Application Configuration Settings You need to change a connection to database and windows phone service references to TileWcfService. Change connection settings in Web.config file: 1: <connectionStrings> 2: <add name="DataConnectionString" connectionString="Server=tcp:[MySQLAzureServerName].database.windows.net; providerName="System.Data.SqlClient" /> 3: Database=MobileData;User ID=[DbUser]@[MySQLAzureServerName];Password=[Password]; 4: Trusted_Connection=False;Encrypt=True;Min pool size = 5; Max pool size = 100" 5: </connectionStrings> Change connection settings in app.config file: Configuration is implemented like a class library with a logic to support external configuration in an app.config file. More information could be found in the article : Creating Bing Maps Tile-Layers in Windows Phone 7 1: <ApplicationSettings> 2: <appSettings> 3: <add key="remoteServer" value="http://[MyHostedServiceName].cloudapp.net/Services/Tile.svc/"/> 4: </appSettings> 5: </ApplicationSettings> Publish the WCF Service Application in Windows Azure : Add a reference to Microsoft.SqlServer.Types library from SQL Server 2008 R2 SDK. Change in properties option “Copy Local” to true. Create a certificate for authentication: for more details you could look at the article: “How to publish your Windows Azure application right from Visual Studio 2010” Publish and run sample application: Enjoy, you have a Windows Phone Application, that receive data from WCF Service , published in Windows Azure, using data from SQL Azure. The migration is painless and easy.