In this article we are going to create a mobile application with Azure using Visual Studio. Before you start with it make sure that you have some azure credits with you. You can always create a new azure free account where you can claim some free credits with an Azure free trial . Please note that you can get only limited Azure credits with the free account. But to get started, that is more than enough. Now we will go and create our application. I hope you will like this.
Download the source code
You can always download the source code here.
Background
We all know what Azure is. If you are really new to Azure, I strongly recommend you to have a look here .To get started, please make sure that you have installed Visual Studio in your machine. Download Visual Studio.
Setting Azure Portal
Login to your Azure portal from Azure Portal. Once you logged in, you can see a dashboard and a menu as follows.
Now click on New -> Web+Mobile -> Mobile App.
Now name your mobile application. Select your subscription, it will be automatically selected if you have only one subscription. Please select the subscription accordingly if you have multiple subscriptions. Select or create new resource group. You may be thinking what is this resource group, and what are all the benefits for using it. According to Microsoft, a resource group is a collection of resources so that you can use those accordingly. A resource can be included only in one resource group and it is possible to link the resources in other resource group. Please be noted that you can’t edit and rename your resource group name. Only option you are allowed is to move your resources to your new resource group. Please see Move resources to a new resource group in azure if you need to move your resources.
Now select your service plan or location as per your need. Now click on that link. You can see all the service plans you have used so far, you can select those if you want or you can create a new one.
To create a new one, please click the ‘Create new’ option.
Now select your app service plan, location, pricing tier. When you select the pricing tier, please be cautious because Azure charge you according to your use. Select it according your use.
Now this is how you Mobile App service set up looks like. You can always pin your mobile app to your dashboard.
Once this is done, you will get a notification that your mobile app deployment is succeeded if nothing goes wrong and you can see the app in your dashboard. Now click on the settings of your mobile application and then quick start.
Select Windows(C#) from it. Now you will be asked to complete three actions.
- Connect a database
- Create a table API
- Configure your client application
Connect a database
Click on connect a database ( We will create a database first). Click Add and add a data connection as follows.
Now give your database name and pricing tier. For now I am going to select the pricing tier as Basic. You can see 5 DTUs are available for Basic tier. According to Microsoft, The Database Transaction Unit (DTU) is the unit of measure in SQL Database that represents the relative power of databases based on a real-world measure: the database transaction. Please read more here.
Did you notice that there is a field called Collation? Basically a collation is a set of rules and regulation we set for the proper use of characters. Like the characters are much different in all the languages, we set the collation accordingly. The default collation for character data in Azure SQL database isSQL_Latin1_General_CP1_CI_AS. You can read about collation here.
Next, set your server and click OK. Once you click OK, you can see the connection strings is being set automatically for you. Creation of data connection may take few minutes. Now we will create a table API.
Create a table API
To store the data in your back end. You need a table, isn’t it? The first option you will see here is select the language for your back end actions. You can select either C# or Node JS.
There was a time, that we can do server side actions only by using server side languages like C#,Vb.Net, PhP etc. Now everything changes, we can do server side actions with few set of JavaScript, that is Node JS.
Once you select your language you can see a message as “Once you’ve downloaded your personalized server project, extract it and open in Visual Studio. Right-click the project and select “Publish” to host the code in your mobile backend. The TodoItem table will be created automatically using Entity Framework.” Now we will do as suggested.
Please open your downloaded project in Visual Studio. Right click the project file then click publish. You can see a window and finish Profile, Connection, Settings steps.
Click publish once you verified the settings. It may take few minutes according to your internet bandwidth. In the meanwhile you can see all the controllers and additional files had been created for us automatically. For example below is the Values controller.
- using System.Web.Http;
- using System.Web.Http.Tracing;
- using Microsoft.Azure.Mobile.Server;
- using Microsoft.Azure.Mobile.Server.Config;
- namespace SibeeshTasksService.Controllers
- {
- // Use the MobileAppController attribute for each ApiController you want to use
- // from your mobile clients
- [MobileAppController]
- public class ValuesController : ApiController
- {
- // GET api/values
- public string Get()
- {
- MobileAppSettingsDictionary settings = this.Configuration.GetMobileAppSettingsProvider().GetMobileAppSettings();
- ITraceWriter traceWriter = this.Configuration.Services.GetTraceWriter();
- string host = settings.HostName ?? "localhost";
- string greeting = "Hello from " + host;
- traceWriter.Info(greeting);
- return greeting;
- }
- // POST api/values
- public string Post()
- {
- return "Hello World!";
- }
- }
- }
Now please go back to your Azure portal.
Configure your client application
It is time to configure our client application now. Download the client application by clicking the link provided. And open the project in Visual Studio. Please install the missing files if it is asked to do so.
Once the installation is done, reload your project and it will be asked to enable developer mode for windows 10. Go ahead and change that in settings.
Now please open the shared project and click on MainPage.cs file, you can see the CRUD operation actions are already created for us.













Azure Mobile App Output Inserting And Reading




Sibeesh VenuPosted May 6, 2016, 6:00 AM
Sr Karthiga Thanks
Sr KarthigaPosted May 6, 2016, 3:47 AM
good one
Sibeesh VenuPosted May 6, 2016, 3:00 AM
Anbu Mani Thanks
Anbu ManiPosted May 6, 2016, 2:37 AM
Nice
Sibeesh VenuPosted May 6, 2016, 1:20 AM
Bhushan Gawale Thanks and welcome
Sibeesh VenuPosted May 6, 2016, 1:20 AM
Kuppurasu Nagaraj Thanks much
Bhushan GawalePosted May 6, 2016, 12:57 AM
Thanks for sharing!
Kuppurasu NagarajPosted May 5, 2016, 1:30 PM
Nice Sharing..
Sibeesh VenuPosted May 5, 2016, 11:06 AM
Debasis Saha Thanks a lot
Sibeesh VenuPosted May 5, 2016, 11:06 AM
Humayun Kabir Mamun Thanks a lot
Sibeesh VenuPosted May 5, 2016, 11:06 AM
Thiruppathi R Thanks much
Debasis SahaPosted May 5, 2016, 9:43 AM
Good one..
Humayun Kabir MamunPosted May 5, 2016, 6:47 AM
Nice...
Thiruppathi RPosted May 5, 2016, 6:38 AM
Great article..
Sibeesh VenuPosted May 5, 2016, 5:04 AM
Vipul Malhotra Thanks much
Sibeesh VenuPosted May 5, 2016, 5:04 AM
Nitin Tyagi Thanks much
Vipul MalhotraPosted May 5, 2016, 4:08 AM
nice article
NitinPosted May 5, 2016, 3:12 AM
Good one
Sibeesh VenuPosted May 5, 2016, 2:27 AM
Nitesh Luharuka Thanks much buddy
Nitesh KejriwalPosted May 5, 2016, 1:44 AM
Great write-up Sibi!