Connecting Windows Apps Using Azure App Service - Part 1

I am getting lot of questions and queries regarding connecting apps to SQL using Azure App Service. So, today I am going to deep dive into:

  1. What is App Service
  2. Creating App Service
  3. Creating API and Tables
  4. Connecting App Service to a Windows App (For this demo I will show it in UWP but it still works same on Windows 8.1 Apps / WPF Softwares)

I will cover part 3 and 4 or Part 2 and Part 3 respectively in the next article to keep things simple.

Let’s Start

WAIT!

I knew about Mobile Service but what is App Service ? What is the difference ? Is Mobile Service discontinued ?

I have answers to that

App Service Mobile Apps is our newest mobile backend platform and gives you additional advantages over Mobile Services. Migrating to App Service is recommended for customers using the .NET backend SDK. However, Mobile Apps Node SDK is currently in preview and is not yet recommended for production use. SDK and API contracts are subject to change within minor version releases.

What advantages do I get with App Service over Mobile Service

Your existing Mobile Service is safe and will remain supported. However there are number of advantages the Azure App Service platform provides for your mobile app that are not available today with Mobile Services: (Reference).

  • Simpler, easier and more cost effective offering for apps that include both web and mobile clients.
  • New host features including Web Jobs, custom CNames, better monitoring.
  • Turnkey integration with Office 365, Dynamics CRM, Salesforce, and other vital SaaS APIs.
  • Support for Java and PHP backend code, in addition to Node.js and .NET.
  • Turnkey integration with Traffic Manager.
  • Connectivity to your on-premise resources and VPNs using VNet in addition to Hybrid Connections.
  • Monitoring and troubleshooting for your app using NewRelic or AppInsights, as well as alerts.
  • Richer spectrum of the underlying compute resources, e.g. VM sizes.
  • Built-in auto scale, load balancing, and performance monitoring.
  • Built-in staging, backup, roll-back, and testing-in-production capabilities.

Now we can definitely start 

What is App Service

Azure App Service is a fully managed Platform as a Service (PaaS) offering for professional developers that brings a rich set of capabilities to web, mobile and integration scenarios. Mobile Apps in Azure App Service offer a highly scalable, globally available mobile application development platform for Enterprise Developers and System Integrators that brings a rich set of capabilities to mobile developers.

mobile service overview

Creating App Service

Step 1: Login on your Azure Portal.

Step 2: Click on New, then on Web + Mobile,

image

Step 3: Click on Mobile App,

image

Step 4: Enter your desired name for Mobile App Service then click on Create (You can also change the other settings as per your wish),

image

Step 5: Open your Mobile App Service from Dashboard (If not found click on All Resources / App Services and open from there),

Step 6: Click on Settings and then click Easy tables,

image

We created container for our mobile service but we have not connected the database yet. Let us connect database first.

Step 7: Click on Add,

image

Step 8: On new Blade click on “SQL Database”, then click on “Create a New database”. Enter the name of the database. At last click on Server,

image

Note : You can also use your existing database. For my purpose I will create a new server and new database.

Step 9: Enter the Server Name, Admin Login, Passwords and make sure you have selected the allow Azure Services to Access Servercheckbox. Cick on OK,

step 9

Step 10: On New database blade click OK,

step 10

Step 11: On “Add data connection” blade click OK.

step 11

Now wait till the data connection is created. You can check the progress by clicking on notification menu on the top of the portal.

image

After the database and server is created it will appear in the notification list and will also be displayed as data connection in the menu.

image

Congratulations! You have successfully created a App Service and connected it to the database. Stay tuned for Part 2 and Part 3 of this series.