How to Create the Azure Mobile Service in Azure Portal

Scope

The purpose of this article is to show how to create an Azure Mobile Service in the portal and how to create the Visual Studio 2013 Project.

This article complements the article:

Microsoft's Windows App Studio Beta: Connecting a Menu App to Azure Mobile Service

Creating the Azure Mobile Service

Go to the Portal, login and click on “+ New”, at the bottom as in the following:

                                                                        new

Use the following procedure:

login portal

The mobile service settings

Then we will see the following screen that should be completed:

mobile service

Note: In this case we selected the free database with 20 MB, be sure that is enough. Each Azure account can only have one free database.

The database settings

In this screen, define all the settings for the database as in the following:

database setting

At the end of this process we will have created the Azure Mobile Services and others related items.

The MyMenuApp items created in Azure Account

When the Azure Mobile Service is created, it will create in your account:

  • An Azure Mobile Service
  • The Notification Hub
  • The Database

Here are the starting points for each.

MyMenuApp Azure Mobile Service

This is the starting point for the Azure Mobile Service created.

Azure Mobile Service

MyMenuAppHub-ns Notification Hub

Each Azure Mobile Service automatically creates a Notification Hub. This topic is outside the scope of this article.

This is the starting point for the Notification Hub related to the Azure Mobile Service created.

Notification Hub

MyMenuuApp_db database

This is the start point for the database related with the Azure Mobile Service created.

Azure Mobile Service created

By default this database is an Azure SQL Database, but the Azure Mobile Service supports the MongoDb database (Non-SQL database), but this scenario is outside the scope of this article. For see more about this, see the following article:

  • Creating MongoDB-backed tables in Azure Mobile Services with .NET backend
Note: Azure SQL Databases have differences from SQL Server Databases, but in general the main features are supported.

How to create the Azure Mobile Service project for Visual Studio 2013

There are two ways to have the Azure Mobile Service project:
  • Creating the project in Visual Studio, using Web or Could Template for Mobile Azure Service
  • Download the project from the Portal that is generated in MyMenuApp - Azure Mobile Service web page.

Creating the project in Visual Studio

Open the Visual Studio 2013 and create a new Web project, as seen below.

Creating the project in Visual Studio

And then select the Azure Mobile Service template as in the following:

Azure Mobile Service template

Here it is possible to define the project for “Host in the cloud”, but for now it will be ignored. Later the project will be associated with the MyMenuApp Azure Mobile Service.

When the project is created it gives us some default classes for the To-do list sample, but it will be removed and ignored. More relative, in this article we will be creating similar classes for the Menu App.

Here is the base project that we will use for the back-end development:

base project

At this moment, the project is completely empty, it only has:

  • WebApiConfig: Defines some configuration for the WebApi
  • MobileServiceContext: Is the DbContext for the services
  • Global.asax: This will called when the project is deployed
  • WebConfig: The configuration for the project will be in this file

Code

See the source code for the AppStudio.Menu.BackEnd, here:

Step 3: Add the base project for AppStudio.Menu.BackEnd.

Download the project from the Portal

Go to the Portal and select the MyMenuApp mobile service as in the following:

MyMenuApp mobile service

And then click in “CREATE A NEW WINDOWS STORE APP” (could be other target), as in the following:

CREATE A NEW WINDOWS STORE APP

Because we have the default Menu App from App Studio, it would be better to create the Azure Mobile Service using Visual Studio.

Nuget Package


The Azure Mobile Service project, for .Net back end, by default is created using the Entity Framework and the main Nuget package used in this kind of project is:

Microsoft Azure Mobile Services .NET Backend Entity Framework Extension


Note:
If the project shows errors related to references it's possible to remove this Nuget package and then install it again to restore the references, in some cases it is required to close the project and open it again.

Up Next
    Ebook Download
    View all
    TOP Azure
    Read by 1 people
    Download Now!
    Learn
    View all