Azure API App how to use single hosted api for both Mobile and Web - azure

This question is related to following questions but not the same question
How can i integrate Azure Mobile App win Azure API app
How to combine azure AppServices API, Mobile and Web apps
I have been trying to setup an API to use with my mobile app(Xamarin) and Web app(Angular or ASP.NET MVC). I wanted to use "Azure App Service".
As i understand there are three things in Azure app service
Web Apps
Mobile Apps
API Apps
I wanted to select the "API APPS" as i wanted to use my Existing ASP.Net Web Api and wanted to expose the Api to swagger. Also I wanted to share this api with Mobile app as well as Web App.
Based on the documentation "API APPS" can be consumed by Mobile and Web clients.Web client is OK but i need to use Azure Mobile features(such as Single Authentications,Notifications,Offline Sync with Sql lite and etc ) to make things easy in Mobile app.
As per answers for above questions and the documentation, i can install mobile app back-end packages to ASP.Web API and host it as "Mobile APPS". So i can use all the features related to mobile.
My problem if i install the mobile back-end, can i use the same API
for Web Front end? Because I am hosting it as "Mobile APPS" service
not the "API APPS" service.
How can I share a single API host with mobile client (With Mobile back end feature) and Web client?
Is it possible to install the Mobile back-end packages and host the
API as "API APPS" , then use Mobile SDK in Xamarin app and the HTTP client or other client in Web APP to consume the same API?

If you want to use the Azure Mobile client SDK, especially features like offline sync, then you need to use the Azure Mobile server SDK. It's a set of NuGet packages that simply extend ASP.NET Web API.
If you want to roll your own mobile client, or just use the authentication feature, then you don't need to use the Azure Mobile server SDK and you can use just Web API.
If you do want to use the server SDK, we have samples that show how to consume this TableController API from a web client:
https://github.com/azure-appservice-samples/contosomoments
Azure App Service field engineer sample with web admin portal and offline-sync-enabled Xamarin.Forms client

Related

Azure web and mobile app (shared API)

I'm currently in the planning process for a mobile app I'd like to build, with a companion web app. The Mobile app and the Web app will share common data (for example, users can take a questionnaire in the mobile app or take the same questionnaire on the web app).
I've used Azure a couple of years ago to create and host a web app, but this is my first venture in mobile development. I'm trying to wrap my head around the architecture in Azure for hosting the API.
I've searched high and low, but either can't find a definitive answer to my question, or am not quite understanding what I am reading on the subject.
Basically: Where would my API live in Azure? Would I create a Mobile App in my App Service, which hosts the shared web API? Then create a Web App in the app service, and use something like RESTSharp to access the API from the web app?
AFAIK, Web Apps and Mobile Apps are just different types of Azure App Service Apps which use to host the relevant applications (e.g. WebApps host website,webapi and MobileApps serve as the mobile backend service). Basically, they are the same and the difference between them is the app type and the Quickstart tutorial for them.
For mobile development, you could leverage the relevant SDKs (server-side and client-side) provided by Mobile Apps. You could also deploy your mobile backend application to Azure Web Apps to get the Mobile Functionality.
For Web Apps, you could follow here to build your web application and deploy to web app. For Mobile Apps, you could follow here to build your mobile backend and the tutorials for building your mobile client project.
Basically: Where would my API live in Azure? Would I create a Mobile App in my App Service, which hosts the shared web API? Then create a Web App in the app service, and use something like RESTSharp to access the API from the web app?
AFAIK, for Azure Mobile Apps backend, you could choose Node.js or C#. The relevant server SDKs provide out-of-the-box CRUD operations against the table. I would use the Mobile Apps SDKs to build my backend project and provide the ability to do operations on the specific table and the custom Web API to handle other operations. For your web app, you could use RESTSharp or just leverage the client SDKs provided by Azure Mobile Apps to communicate with your mobile backend endpoint (hosting on a web app or a mobile app).
For C# mobile app backend and mobile client side tutorials, you could follow adrian hall's book here.
For Node.js related mobile backend development, you could follow 30 DAYS OF AZURE MOBILE APPS.

Azure Mobile App Service

I would like to create a mobile app with Xamarin Forms and would like to use the new Azure Mobile App PaaS service. This mobile app shall be available also to users which uses my services from a web site and not only from a mobile device.
In regards to Authentication how can I have a single authentication point available either from a web site as well as from the mobile app?
Does anyone have suggestions on how to design this architecture?
The Azure App Service, the Mobile Apps backend service is really just a Web API running in Web Apps (think web site + mobile goodness), with all features of App Service sharing the same authentication endpoint. This means that any authentication you setup for mobile device clients can also be used by a web site. This topic should point you in the right direction: https://azure.microsoft.com/documentation/articles/app-service-mobile-auth/

Azure Web App vs Azure Mobile App

I have created an Azure Web App today and it has a Mobile section in the Settings which contains Push notification, Mobile Authentication, etc. You can even download the source code for a mobile client app. I know that this used to be part of Mobile App (Mobile Service). I have created an Azure Mobile App to compare with Web App and they look the same in terms of Settings and Tools. Even the Icon is the same.
My question is what is what is the difference between Azure Web App and Azure Mobile App?
Like you, I couldn't get my head around the difference between the different types of App Service apps (Web Apps / Mobile Apps / API Apps). Judging by the fact that no one has really answered your question, it looks like we weren't the only ones.
It made no sense to me that Web Apps, Mobile Apps and API apps were distinct things: surely the whole point is that you should be able to expose an API that serves your web site, your mobile apps, any other kind of client, making use of whichever features you need for your use case?
And, lo and behold, buried deep in the Azure docs:
The only difference between the three app types (API, web, mobile) is the name and icon used for them in the Azure portal.
Yep: they're exactly the same.
In old days of Azure, they had 2 offerings - Azure Websites and Azure Mobile services. Some time ago, both of them got rolled into something called Azure App Service which also included two more kinds of apps - API Apps and Logic Apps.
To answer your question specifically, Azure Web App is new name for Azure Websites that you can use to build websites in multiple languages where as Azure Mobile App is the new name for Azure Mobile Service that provides backend infrastructure for mobile applications (or in other words, Azure Mobile App is Mobile Backend-as-a-Service [MBaaS] offering from Azure).
Mobile Service is the "classic" version and is only available in the classic portal. Mobile Apps is part of App Service is only available in the preview portal.
App Service includes Web Apps, Mobile Apps, API Apps and Logic Apps is deployed as one unit. Using the classic way, you would have to create and pay let's say for a Web App and a Mobile Service so you can save money using the App Service. You also get a larger selection of VMs.
Not all Mobile Services features have been migrated yet to Mobile Apps. If you use a Node.js backend, there's no nice UI built-in in the new portal to manage your JS code.
Note that Microsoft has not announced that it will deprecate Mobile Services.
I have found some subtle, but key, differences. Assuming a C# backend, the Mobile App Service controllers will inherit from TableController - which provides out-of-the-box CRUD operations on a table, compared to the Web Api 2 style ApiController (which you can still use in a Mobile App Service). Any less confused now?
Sorry for the late reply. They all are really the same thing. If you look in Azure Resource Explorer (available in the application menu of your app or resources.azure.com) you will see the indication of how we display a different icon for it - "kind": "mobileapp", for Mobile Apps for example. We leverage the different kinds to provide different quick-starts. You can certainly create an Azure Web App and load Azure Web App code to it to get the Mobile Functionality.

How can i integrate Azure Mobile App win Azure API app

We are building a mobile cross platform solution with Xamarin (Xamarin.Forms).
We developed a backend API in Azure with Azure API Apps.
Now we want to integrate and use Mobile Apps (Mobile Services) but using Azure API Apps we created previously.
I see this BUILD presentation https://channel9.msdn.com/Events/Build/2014/3-623
and the idea i think is to use ApiController and call to Azure API Apps there.
Is this correct? Some sample? How can i do? I must have 2 projects API Apps + Mobile Apps? or I must integrate in one (only one API)?
You could potentially have your mobile clients connect to your API app, but you'll have an easier time if you convert your API App to use the Mobile App backend packages. Another option is to have your Mobile App backend connect to the API app, but that's a lot of hops without much benefit.
For details on these packages, see How to work with the .NET backend server SDK for Azure Mobile Apps.
For a step-by-step tutorial, start with Create a Xamarin.Forms app on Azure Mobile Apps.

authenticate MVC4 mobile web application with mobile azure service

How to authenticate MVC4 mobile web application with mobile azure service?
I would like to authenticate the Live Id from MVC app, and I would like to use mobile azure service as the back end, so that it can share same service with our windows 8 apps.
As of now Azure Mobile Services (a.k.a. ZUMO) is only supported for Windows 8 however you sure can use it with other applications as well and mostly WebAPI is the best option to tie with your MVC application mainly while using Web API as a proxy.
You can use the the article Using Azure Mobile Services in your web apps through ASP.NET Web API, in your MVC4 application to authenticate your application with Mobile Azure Services.

Resources