How to create the Azure Mobile Service in Azure Portal
This article aims 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
Creating the Azure Mobile Service
Go to the Portal , login and click on “+ New”, at the bottom
Do the following steps
The mobile service settings
Then we will see the following screen that should be completed:
Note: In this case we selected the free database with 20 MB, be sure that is enough. Each Azure account only can have one free database.
The database settings
In this screen, define all settings for the database
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 start point for the Azure Mobile Service created.
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 start point for the Notification Hub related with Azure Mobile Service created.
This is the start point for the database related with the Azure Mobile Service created.
By default this database is an Azure SQL Database, but the Azure Mobile Service supports MongoDb database (NonSQL database), but this scenario is outside the scope of this article. For see more about this, see the following article
Note: Azure SQL Database has differences from SQL Server Database, 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
And then select the 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
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
See the source code for the AppStudio.Menu.BackEnd, here
Download the project from the Portal
Go to the Portal , and select the MyMenuApp mobile service
And then click in “CREATE A NEW WINDOWS STORE APP” (could be other target), as following
Because we have the default Menu App from App Studio , it would be better to create the Azure Mobile Service using Visual Studio.
The Azure Mobile Service project, for .Net back end, by default is created using Entity Framework and the main Nuget package used in this kind of project is
Note: If the project shows errors related with references it’s possible to remove this Nuget package and then install it again to restore references, in some cases it is required to close the project and open it again.