How to create #Azure Mobile Service from the portal?
Few days ago, I wrote about “ Introduction to Azure Mobile Services ” and I hope, that gave you basic overview of the same. As ongoing tutor...- Article authored by Kunal Chowdhury on .
Few days ago, I wrote about “ Introduction to Azure Mobile Services ” and I hope, that gave you basic overview of the same. As ongoing tutor...- Article authored by Kunal Chowdhury on .
Few days ago, I wrote about “Introduction to Azure Mobile Services” and I hope, that gave you basic overview of the same. As ongoing tutorial on this subject, we will learn how to integrate mobile service in our app to utilize the already available APIs.
But before that, we need to create the service. Today, in this blog post, we will learn how to create the mobile service from the Azure portal.
If you want to know what is Windows Azure Mobile Service, Key scenarios, when to use it, it’s supported platforms etc. read my last post on Mobile Service, which will give you the basic overview.
Before continuing, I hope, you already registered to Azure portal and have an active subscription of it. If not, first register into the portal (you can opt out a trial subscription too).
Once logged-in, navigate to the “Mobile Services” tab available at the left navigation panel of the portal. If you have existing mobile services, this will list down all of them there; else it will look blank as below. To create a new service, click the link that says “Create a new Mobile Service”.
A popup window will open up. You need to fill all the details asked by the wizard. First, you need to provide an unique name for the URL of the mobile service. It will validate it automatically once entered and show a green or red check mark. Then enter the database details. If you already have a database hosted in Azure portal, you can use that. In our demo, we will go with creating a free 20 MB SQL database.
Select the region and backend as per your choice. You can choose either .NET or JavaScript as the backend. I would prefer JavaScript here to utilize additional functionality within the portal. This will not have any impact to the app platform that you are going to use.
In case you want to configure the Azure Mobile Service to send push notification, you can select the checkbox “Configure advanced push settings”. You can configure this later too. However, we will configure it now itself.
Click next to proceed to the next page “Notification Hub”, where you have to create a namespace and have to enter a nub name for it. Make sure to provide a valid unique name to it. Once done, click next.
In the third screen, you have to configure the database settings. Give your database a name, set it’s login credentials, select a region (make sure to select the same region where you hosted your mobile service). Once done, click OK.
This will start creating the Azure Mobile Service and it’s associated items in the Azure portal, which you can further configure before using in your app or website.
Once the creation is successful, you can find the new mobile service, the SQL database and the service bus in the all items page. Click the “All Items” navigation link available at the left pane of the screen to find out more about the service and the associated resources. Find below a screenshot of the same for our mobile service demo:
Click the mobile service that we just created now. It will navigate you to the dashboard of the service where you can find out more about it, configure it further.
The first tab i.e. “Dashboard” shows you details about the service like how many API calls has been made till now, how much data has been utilized, if any errors, CPU utilization, service endpoints and more.
The next tab is the Data, where you can add or configure table structure, manage records. After the data tab, there are couple more tabs named API, Scheduler, Push, Identity, Configure, Scale and Logs.
API tab provides you option to create custom APIs to use with this mobile service. Scheduler tab allows you to create jobs which can execute on defined time. If you want to use Push Notification Service, the tab named Push will allow you further customize it. If you want to add login mechanism with Microsoft account, Facebook, Twitter, Google or Azure active directory in your application, you can configure the API key/Secret key here. Configure tab allows you to do configuration changes to SQL server, GIT source control URL, dynamic schema of your database table, analytics, connection strings and more. Scale tab allows you to change the mobile service tier, capacity etc. If you want to check the service logs, you can find them in the tab named Logs.
Let’s not go in details of all the tabs, but show you more about creating and using the mobile service. Come back to the data tab. If you want to create a table to use from your code, you can do it here by clicking the “Add a Table” link. If you have dynamic schema enabled, you can create the table from code too. Let’s create a new table from the portal.
Once you click “Add a Table”, the following “Create New Table” window will popup in the screen. Give a name to the table and set the permissions properly. You can later change the permissions from the portal. If you want to enable undo delete operation, you can check the “Enable soft delete” checkbox. Otherwise, delete operation will be permanent.
Once you create the table, it has four different tabs named browse, script, columns and permissions. The browse tab will list down the records in a tabular format. As we just created this table, we don’t have any records at this moment. Later we will revisit this screen again to see the records once we push some data into the table.
The script tab allows you to perform additional checks/validation/operation at the time of doing CRUD operation on the table. You need to use Node.js scripts there. If you have enabled the backed as JavaScript, you will find this option here.
The columns tab lists down all the columns of this table. If you want to add additional columns, you can click on “Add Column” button at the bottom of the screen. If you have already enabled the dynamic schema, you don’t have to worry about it here. When dynamic schema is enabled, it will automatically create the proper columns based on your data model.
Permission tab allows you to set the table permission for CRUD operation. There are four different permission level available and they are: Everyone, Anybody with the application key, Only authenticated users, Only scripts and admins. The names of the individual permission level itself demonstrates the functionality.
That’s more about creation of Azure mobile service, it’s various configuration settings. Just follow the above mentioned steps to create your first mobile service to use in your application or website. In the next chapter of the tutorial series, we will learn hos to integrate the mobile service in a Windows application. We will demonstrate it with an Universal Windows app. Till that time, play with the Azure portal or proceed next to read the other chapters of this Azure Tutorial series.
If you like my post, don’t forget to become a fan of my Facebook page. Also, I am available on Twitter and Google+. Do connect with me to get the updates that I share. Subscribe to my blog’s newsletter and RSS feed to get the immediate notification of new post in your inbox.
Thank you for visiting our website!
We value your engagement and would love to hear your thoughts. Don't forget to leave a comment below to share your feedback, opinions, or questions.
We believe in fostering an interactive and inclusive community, and your comments play a crucial role in creating that environment.