Im Still new in Azure Mobile App Service, i have question about Azure Mobile App Service , Can we make 2 Api and publish it to Azure Mobile App Service. Example my App Service is http://netbackends.azurewebsites.net and i have 2 Web Api that i want to add in the App Service, for instance the web api is one for CRUD users data and the other one is for Payment. Can we do that in App service ? And make Endpoint for calling the Api, example http://netbackends.azurewebsites.net/CRUD or http://netbackends.azurewebsites.net/payment , or we only can have one Api in App service ?
And make Endpoint for calling the Api, example http://netbackends.azurewebsites.net/CRUD or http://netbackends.azurewebsites.net/payment
Sure, we could add the custom APIs as we want. The following is the demo how to add the custom API for a Mobile App. You also could refer to this book to get more information.
1.Create mobile App with VS
2.Add the custom control
3.If we want to use the custom route path we could add the following code in the
Startup.MobileApp.cs file
config.MapHttpAttributeRoutes();
settings.SkipVersionCheck = true; //just for test
Add mapped route in the control
Publish it to azure as mobile service and check the result.
Related
How can I go about creating an https form and getting input from there into dataverse without having an app created on Microsoft.
you will have to create application user in Azure to use dataverse API
Step by step to connect to D365 with a client_secret to use APIs
This is one example of how to consue dataverse API using Application user in python
There are numerous other example of consuming dataverse API, bascially you will need to authicate and get Token and then accees API
I need advice as i am new in .net and azure, i am creating a architecture for a project which has its mobile application, web based admin panel and Website.
I am planning to host every thing in Azure. I am creating application in Xamarin. Application needs to have Push Notification, Offline Sync etc, features provided by Mobile App Services (Controller inherited from TableController).
I want to create 1 database which will be used by all 3 modules. I have already created a Mobile App Service and Database. Mobile application is using it as it was supposed to. Now i want to create a website and Web based admin panel and use the same database. Is this possible ?
What is the best way? Should i create a web project and perform operations on data via REST API? and use this API for Mobile Apps and Web based Backend?
I am really confused between different services from azure and which one to use. Should i use .Net Core or .Net. I need to know the best way to do it.
Edit 1 :
So far this is what i have done and i need to know if this will work fine in future when project get complex. I created database and back end via Azure Mobile App. Now i have created a .net MVC website and used RestSharp for CRUD operations in it. I have used the following code to perform the operations. Note the /tables/ part in the request url.
var client = new RestClient("http://xxxxxxx.azurewebsites.net");
var request = new RestRequest("/tables/request?ZUMO-API-VERSION=2.0.0", Method.POST);
string data = "{\"createdFor\":\"535862cf-e2b3-41de-99f9-88c47a77750c\",\"status\":\"IN_PROCESS\",\"createdBy\":\"7108147e-c11c-4d78-ac3d-d5d6c5eb78d0\",\"description\":\"Master room 5 door produces strange sound when opened or closed\",\"title\":\"Door Sounds Strange\"}";
request.AddHeader("Accept", "application/json");
request.Parameters.Clear();
request.AddParameter("application/json", data, ParameterType.RequestBody);
var result = client.Execute(request);
Console.WriteLine("Content " + result.Content);
Get and post operations works fine. Is this a good way?
Thanks in advance
As the official document mentions about Mobile App Features:
Authentication and Authorization (AAD,Facebook, Google, Twitter and Microsoft Account,Custom authentication)
Data Store (SQL Database, Azure Table Storage,etc)
Offline Sync
Push Notifications (Client SDKS seamlessly integrate with the registration capabilities of Azure Notification Hubs)
Client SDKs (A complete set of Client SDKs that cover native development, cross-platform development,etc)
Per my understanding, if the build-in features provided by mobile app could totally meet your requirement, then Mobile App is better for you and it would save your time. For Web API application, you need to do all stuff by yourself.
Now i want to create a website and Web based admin panel and use the same database. Is this possible ?
I assumed that you could create a Azure Mobile App application (Mobile App) and a web application (Azure Web App) under your solution, and you could extract the DbContext related classes into a shared class library.
Should i use .Net Core or .Net. I need to know the best way to do it.
For choosing between .NET Core and .NET Framework, you could refer to the official document about choosing-core-framework-server.
UPDATE:
Can you please take a look at edit 1, and suggest if this is the right way or it can create a problem.
Your code would work fine, since the mobile client SDK just wraps the common processing as your provided.
Note:
For accessing only by authenticated user, you need to add x-zumo-auth header with the authenticationToken after you logged.
Additionally, for your MVC application to retrieve the data from your mobile app (need authentication), you need to log with your mobile app and retrieve the authenticationToken for your subsequent requests against your mobile app. At this point, except for Custom authentication, otherwise you could only leverage Client-managed authentication and use JavaScript client library for Azure Mobile Apps in your MVC application for logging to mobile app and retrieve the authenticationToken, then you could send request from your front-end or pass the token to your back-end. For SPA, you could use both Client-managed authentication and Server-managed authentication.
Moreover, Adrian hall has wrote some useful tutorials about developing against azure mobile app, you could refer to Adrian hall's book.
UPDATE2:
For custom authentication using an Identity Database, you just pass the username and password to your mobile app, then it would validate the user info and generate the authenticationToken. While for Auth0, you firstly login with Auth0 provider, then pass the token to your mobile app.
My mobile application has its own signing up and sign in option with username and password.
For the connection Username-Password-Authentication from Auth0, it would manage the users for you, while using an Identity Database, the users would be stored in your storage and you need to manage them by yourself.
Per my understanding, both approaches could implement the custom authentication for you, but you need to choose the better one that matches your scenario.
I have upgraded my Xamarin.Forms app from Microsoft.WindowsAzure.Mobile.SQLStore to Microsoft.Azure.Mobile.Client.SQLiteStore. My authentication is implemented like this:
public async Task<MobileServiceUser> Authorize(MobileServiceAuthenticationProvider provider, IMobileServiceClient client)
{
return await client.LoginAsync(AppDelegate.MainView.RootViewController, provider);
}
But the authentication dialog displays the following message now:
{"code":404 "error":"Error: Not Found" }
I use Google, Microsoft and Facebook authentication. This authentication worked perfectly fine before I upgraded. I tried to go through this documentation but it is based on some sample project that I cannot recreate. Any ideas why this isn't working anymore?
I use Google, Microsoft and Facebook authentication. This authentication worked perfectly fine before I upgraded.
Per my understanding, your mobile backend is hosted by Azure Mobile Services (with the URL like: service.azure-mobile.net).
Microsoft.Azure.Mobile.Client.SQLiteStore has the dependencies of Microsoft.Azure.Mobile.Client which is used to connect to Azure Mobile Apps. After you upgraded from Microsoft.WindowsAzure.Mobile.SQLStore to Microsoft.Azure.Mobile.Client.SQLiteStore, then Microsoft.Azure.Mobile.Client would be installed automatically.
For MobileServiceClient from Microsoft.Azure.Mobile.Client, the LoginAsync method with the specific provider would send the request as follows:
http(s)://{your-mobile-backend-URL}/.auth/login/{provider-name}
{"code":404 "error":"Error: Not Found" }
In summary, if you want to use Microsoft.Azure.Mobile.Client.SQLiteStore, then your mobile backend need to be hosted by Azure Mobile Apps which you could think of it as Azure Mobile Services V2. Additionally, you could leverage fiddler to collect the network traces when handling login operation for troubleshooting this issue. Also, you could refer to Migrate your existing Azure Mobile Service to Azure App Service.
UPDATE:
I checked the source code about Microsoft.Azure.Mobile.Client and found the LoginAsyncOverride method under MobileServiceTokenAuthentication.cs. You could specify MobileServiceClient.LoginUriPrefix to override the login prefix specified by LoginAsyncUriFragment field configured as /.auth/login from MobileServiceAuthentication.cs.
For mobile service backend and using mobile app client SDK, I assumed that you could leverage the following code:
MobileServiceClient client = new MobileServiceClient("https://{your-app-name}.azure-mobile.net/")
{
LoginUriPrefix = "/login"
};
var user=await client.LoginAsync(MobileServiceAuthenticationProvider.Facebook,false);
Note: I just tested the login operation, you need to check with your mobile client and verify whether the related operations could work as expected. Additionally, I would still recommend that you could try to upgrade your mobile service to azure mobile app for more powerful features. You could refer to Mobile Services vs. App Service for more details.
I have backend(e.g. https://api.myapp.com) based on the Azure Mobile services(AMS), now I need
1. add one or two apis that doesn't require to be on AMS e.g. an heartbeat controller to check that service is online or not, that doesn't require Zumo Auth
2. an ASP.net MVC page(e.g. https://www.myapp.com) that explains about the application
Can I use the existing AMS to do this, I tried to add plain asp.net web api, but getting error that end point doesn't exist
Are you truly using Azure Mobile Services and not Azure Mobile Apps? You generally cannot have a custom domain on Azure Mobile Services. Since you mention ZUMO Auth 2, I'm assuming you mean App Service Auth and thus Azure Mobile Apps.
I'd recommend taking a look at Azure Functions for any APIs that do not require ZUMO. However, you can just add a custom API to your service. I cover all the options for you in my book - http://aka.ms/zumobook - chapter 4.
As to a service controller for checking heartbeat. If the intent is to ensure that the service is alive, then just create an unauthenticated custom API that tests the database connectivity (maybe does an SQL command to get the count of rows in your main table) and returns success or failure. You can then use Azure Functions, Azure Scheduler or OMS to do a query of that custom API.
I want to use datastore of google in my web app but do not want to host it in google app engine, I want to host it some other machine. So how i can use datastore in such web app ?
will it be more economical ?
You would need to follow the Accessing the Cloud Datastore API from another platform procedure:
This section shows how to activate and access the Cloud Datastore API
from an external application running on a platform outside of Google
Cloud.
Enable the Cloud Datastore API for the project. You can enable the API for an existing project, or create a new project and then enable
the API.
Enable the Cloud Datastore API
To use the Cloud Datastore API, your Cloud project requires an active App Engine application. Open the App Engine dashboard and
confirm your Cloud project has an active App Engine app.
Open the App Engine dashboard
Create an App Engine app if needed. The app must not be disabled.
Go to the Create service account key page.
Click the drop-down box below Service account, then click New service account.
Enter a name for the service account in Name.
Use the default Service account ID or generate a different one.
Select JSON in Key type.
Click Create.
Upon successful creation, your browser will download the private key. The Cloud Platform Console provides a prompt that displays the
private key file name. Note the file name so you can locate it, then
click Close to dismiss the prompt.
Your Service Account is the Email address displayed under the Service Account section.
Your Private Key is the file you just downloaded.
At this point all services and authorizations are configured for your
project and you can start writing code or exploring the API.
You don't actually need to write code for the GAE app and deploy it, see Is an App Engine instance required for accessing Datastore?
As for being more economical or not (I presume compared to running the app on GAE) - it depends a lot on the app's usage/scale, what the app does and how it does it.
Have a look at Cloud Endpoints
https://cloud.google.com/appengine/docs/java/endpoints/