Bits and Bytes: Migration of Azure Mobile Services to Azure App Services

For the past year Azure Mobile Services has come a long way. From adding easy access to making custom API’s and table scripts to combining push notifications and identity management. However, this past December Mobile Services has a new name, App Services. App Services now contains, Web Apps, Mobile Apps, Logic Apps and API Apps. With App service you get the following benefits:

  • Easily connect your app to data in the cloud or on-premises, including SQL Azure, SQL on-premises, Mongo, Azure Table Storage, SaaS APIs like Dynamics and Salesforce.
  • Enable your app to work with data offline and sync with above mentioned data sources
  • Build mobile backend APIs in seconds without writing any code
  • Intuitive SDKs for iOS, Android, Windows, as well as cross-platform frameworks like Xamarin, and Cordova
  • Extend your mobile backend with custom code by leveraging App Service Mobile .NET or Node.js server side SDK, or directly via REST frameworks for other languages supported on App Service including PHP, Java, or Python
  • Cross-platform push notifications to iOS, Android, Windows, Kindle and other devices (this capability is also available as a separate service: Notification Hubs)
  • Authenticate and Authorize your users without adding any backend code using App Service Authentication/Authorization features
  • AND MORE!

You are probably saying “that is great, but what does this have to with Azure Mobile Services”. Well it is because you want to use the new App Service model for your development. If you are starting a new project, clicking through and building a service using App Service is easy and straightforward. Here is a video that shows how to get up and running in no time.

However, what if you have invested your time and effort into Azure Mobile Services? How can it benefit from all of these awesome features? Well, it starts with Migrating to Azure App Services! You might say that migrating has always be a pain or even black magic. In some instances it has. However, with the Migration Tool for Mobile Services it makes it pretty easy and straight forward.

A few things to note before you attempt to migrate.

  • If you “MIGRATE” your site, there will be no code changes needed to your scripts.
  • If you “UPGRADE” your site, you will have to make code changes to your scripts to take advantage of the new mobile SDK.

In this post we are going to talk about MIGRATION.

The next thing to note is what tier you are on with your current Mobile Services and how many do you have. If you are on Free or Basic and have multiple mobile services, all of them will be migrated. If you only want one migrated you will have to “upgrade” to the standard tier. Here are the steps to do that.

  1. Log onto the Azure Classic Portal.
  2. Select your Mobile Service.
  3. Select the SCALE UP tab.
  4. Under Mobile Service Tier, click on the STANDARD tier. Click on the SAVE icon at the bottom of the page.

Remember to set the pricing tier to an appropriate setting after migration.

Here is a Bits and Bytes video on how to migrate your Azure Mobile Services over to Mobile App Services.
bitsbytesmigrateappservice

How to Migrate Your Mobile Service

  1. Log onto the Azure Classic Portal.
  2. Select your Mobile Service.
  3. Click on the Migrate to App Service button.The Migrate Button
  4. Read the Migrate to App Service dialog.
  5. Enter the name of your Mobile Service in the box provided. For example, if your domain name is contoso.azure-mobile.net, then enter contoso in the box provided.
  6. Click on the tick button.

 

Once done, head on over to the Azure Portal and view your new Mobile App Service!

KISS PARSE GOODBYE

Bits and Bytes: Forget Parse, Use Azure Mobile Services to Create an API for your Mobile App or Website

When you are building a mobile app or a website mostly likely you are going to need some type of data repository. This can be either files, video or in the form of a “database”. In order to access these repositories you need some sort of access mechanism. Sometimes it is a library or SDK others it is a connection to the database. However, with a mobile app or even websites that are distributed the connection to these repositories can be tricky. You need to create some sort of endpoint for these. Back in the day these were called Web Services now they are called API or Web API’s. Creating them can be time consuming as well. You have to create all of the routines needed to get and put data. You will need to create authentication mechanisms to make sure the proper user is getting and putting data. All in all this could be very time consuming.

Until today! Enter in Azure Mobile Services. A quick and easy way to consume an API endpoint for iOS, Android, Windows and HTML/JavaScript. We will look at creating these API’s using the “Classic Azure Portal”.

channel-9-mobile-services

If you want to use the new method of Azure App Services, here is a video as well.

channel-9-mobile-app-services

First off, make sure you sign up for your Azure account before we begin.

 

Create Mobile Service

  1. Login to the Classic Azure Portal. Click on NEW -> MOBILE SERVICE -> CREATE
  2. Enter a url for your clients to access the service.
  3. Choose eiher an existing SQL Server or Create a New SQL Server (this is used to host your database).
  4. Done
Responsive image

Create Your Data Table(s)

  1. Click on the Mobile Service name you just created.
  2. In the navigation tab, select DATA.
  3. On the bottom of the screen, click CREATE and choose a table name. You can also modify permissions if needed.
  4. Done
Responsive image

Modify Your Schema

  1. Click on the table name you just created and select COLUMN from the navigation tab.
  2. On the bottom of the screen, click ADD COLUMN and add as needed.
  3. You can connect to the Database you just created by using a SQL client tool and your connection string.
  4. To find your connection string click on DB in the left nav, find your Database name and you will see your connection string.
  5. Windows: can use SQL Management Tools or Cloud Explorer (within Visual Studio), or Mac: SQLPro for MSSQL or Mac SQL Studio
  6. FYI: if you are connecting to the SQL server you will have to add your ip address to the server firewall.
  7. Done
Responsive image

Access Your Table API

  1. Automatically you will get a CRUD (create, read, update, delete) API created for you.
  2. Click on the table and then click on SCRIPT in the navigation tab
  3. There will be 4 scripts that you can modify if needed.
  4. FYI: if you name your object and properties in your code, then no need to change anything in the api unless you need specific business logic
  5. Your endpoint will be: https://MOBILE SERVICE NAME.azure-mobile.net/tables/TABLE NAME
  6. Done
Responsive image

Create A Custom API

  1. From our Mobile Services page, click on the navigation tab API.
  2. Click CREATE -> and provide your custom API with a name.
  3. Here you can build custom logic to query multiple tables or perform some other routine.
  4. Your endpoint will be: https://MOBILE SERVICE NAME.azure-mobile.net/api/API NAME
  5. Done
Responsive image

View Errors and Logs

  1. From our Mobile Services page, click on the navigation tab LOGS.
  2. All logs will be there.
  3. Done
Responsive image