Quantcast
Channel: Azure Mobile Apps forum
Viewing all 3756 articles
Browse latest View live

Migrating from Parse.com to Azure

$
0
0
Since parse is closing, and we have a lot of iOS, Android apps pointed to it (PFObjects, cloud code, notifications etc) I was wondering is it possible to use Azure in very similar way and can't find any proper documentation on this

Row Level Security in Azure Mobile Apps

$
0
0
I'm trying to implement row level security in my app, I have tried to follow this guide but I can't seem to wrap my head around it:

https://azure.microsoft.com/en-us/blog/building-more-secure-middle-tier-applications-with-azure-sql-database-using-row-level-security/

I also can't seem to find any examples of how to do this from a .NET Web App (Azure Mobile App Backend).

I don't understand how the database is supposed to know which user is logged in, since it's a middle-tier application that uses the same credentials for all users.

It says to set the Context_Info, am I supposed to do this in each of my Table Controllers?
If so, how?
There's no documentation on this anywhere, which seems odd to me...

Any ideas?

Mobile App with ADAL on WP8.1 - Audience validation failed

$
0
0

Hi, I want to migrate my WAMS to thenuget stable Mobile Apps, but with this version authentication fail.

Trying to access from browser works without problem, redirect to Azure Login and then I can see json result, so I think that Azure AD WebApi is ok.

When I try to access from WP8.1 with ADAL, result is InvalidOpEx with error "You do not have permission to view this directory or page." and in site logs there is:

Received request: POST https://mysite.azurewebsites.net/.auth/login/aad

JWT validation failed: IDX10214: Audience validation failed. Audiences: 'https://mysite.azurewebsites.net/login/aad'. Did not match:  validationParameters.ValidAudience: 'AzureAD-WebApi-Id-Client' or validationParameters.ValidAudiences: 'http://mysite.azurewebsites.net'.

Sending response: 401.71 Unauthorized

I've changed value in Azure AD app to match Audience requested, but same validation error.

With old version the solution was to setMS_AadAudience, any idea for this version o where can I find this settings in portal?

Why in documentation tell me to user https and the validation expect http ?

Securing access to Mobile App API

$
0
0

Hello! I'm starting using the Mobile App feature in Azure and as I noticed in Quick Start guide to connect my appliction to the API I need to write such line of code

public static MobileServiceClient MobileService =
    new MobileServiceClient("https://***.azurewebsites.net"
);
So, as far as I understand, anyone who knows the address of the mobile app service can connect to my API and use it's data and features. Is there any way to make this more secure? Previously I've used Parse and there to connect to API I had to provide application ID and key. Lets say here the application ID is the https connection string, so is there any way to add something like application key?

[Node.js] Android. Logining with email and password.

$
0
0
Hello, I read an article about user authentication in Android applications(https://azure.microsoft.com/en-us/documentation/articles/mobile-services-android-get-started-users/). Only the use of social networks is considered there but there is no method to authorize by the usual login and password. Is there an official tutorial how to do it?

Microsoft.WindowsAzure.MobileServices.MobileServiceInvalidOperationException with 401 -'Unauthorized' when trying to call InsertAsync()

$
0
0

Hello,

I get a Microsoft.WindowsAzure.MobileServices.MobileServiceInvalidOperationException with 401 -'Unauthorized' when trying to call InsertAsync() on an IMobileServiceTable<T> instance. I am using Microsoft.WindowsAzure.Mobile.Client (2.0.0.0) in an UWP App. I use the LoginAsync() method with MobileServiceAuthenticationProvider for user authentication.

We are trying to upload data from the client to an Azure Mobile Service that has been converted to a Web App (We needed to use a Web App because the client would not connect to the service for authentication when it was a Mobile Service)

I am able to use InsertAsync() when I use WindowsAzure.MobileServices (v1.3.2) and simply pass the URI and key for the mobile service, but this does not meet the requirements – we need to authenticate the user.

The problem is that when we use Microsoft.WindowsAzure.Mobile.Client (2.0.0.0), it no longer has a constructor that takes both the URI and the key.

The client ID and Client secret are configured on Azure.

Any advice on how to proceed to pass the data without getting any exceptions will be much appreciated.

Thanks,

Abie

Setting HTTPS in custom domain mobile services

$
0
0

Hi there, I have set up a mobile services. I have migrated it from the classic portal to the new portal. I've bought a wildcard certificate form Certificate Authority to support all subdomains for my main domain. I've generated the ".pfx" file, uploaded it to azure and put the password to it.

My issue is the now I want to enable the SSL binding, so I choose my domain yyy.mydomain.com, the SNI SSL is selected by default, but when I want to choose the certificate in the combobox, it appears empty:

Is my certificate not valid, or do you have any idea, what might be wrong or missing? Thanks in advance.

Authenticate user using Microsoft Account in .Net backend Azure Mobile service giving error after login - We can't connect to the service you need night now.

$
0
0

Hi All,

I am developing Windows 10 UWP app in that I am Implementing authenticate user using Azure Mobile Services using Microsoft account as provider.

I followed the below article for registering mobile service with the app

https://azure.microsoft.com/en-us/documentation/articles/mobile-services-how-to-register-microsoft-authentication/

The following are the details I updated in my app live settings

My Mobile service is a .net backend service https://astraniprod.azure-mobile.net/

And also updated the client ID, secret, app SID in Mobile Service.

After that I have written the below code to launch the login popup in my app

private async System.Threading.Tasks.Task<bool> AuthenticateAsync()
        {
            string message;
            bool success = false;
            try
            {
                // Change 'MobileService' to the name of your MobileServiceClient instance.
                // Sign-in using Facebook authentication.
                user = await App.MobileService
                    .LoginAsync(MobileServiceAuthenticationProvider.MicrosoftAccount,true);
                message =
                    string.Format("You are now signed in - {0}", user.UserId);

                success = true;
            }
            catch (InvalidOperationException)
            {
                message = "You must log in. Login Required";
            }

            var dialog = new MessageDialog(message);
            dialog.Commands.Add(new UICommand("OK"));
            await dialog.ShowAsync();
            return success;
        }
    }

I am able to see the login dialogue and also entered my Microsoft account and password, After that I am getting the following error

I seen other people also posted about this in forums but I didn't find the solution for the issue, I don't know where the issue is, other Providers like Google, Twitter, Facebook working fine, but only Microsoft account not working.

Thanks.



Authentication tokens expiring quickly

$
0
0

I created a new App Services Mobile App, and I notice I am being prompted to log in after only a few hours.
After using a helper method I found online to check if a token is expired, I am seeing that my cached tokens are expiring only a few hours or so after login.

I did not have this problem with my 3 previous Azure Mobile Services apps, or with my most recent Azure App Service web app.

Is this something new in Mobile Apps?

How can I provide users with a fluid login experience so that they almost never have to sign in after the initial login?

Azure mobile services - localhost Try it Out / API help displayed

$
0
0

I am new to the Azure and Mobile Services, I like the concept and how they are minimized the coding efforts to only business logic level. when I tried with the given template (downloaded from Azure or a new project from visual studio 2015 Community). I was able to compile and mobile services are up, running be I don't see the "Try it Out" link and wondering how to access those. when I tried with url it shows below error message.

My project development environment and project is configured to use LocalDb with few Todo item entries and no internet. trying to work offline though.

HTTP Error 404.0 - Not Found

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.


Regards Nagendra Rao Jogi.

Simple Azure demo mobile service app does not run in Eclipse out of the box :(

$
0
0

I followed the instructions on this page "quickstart" page and the simple demo app does not run in Eclipse (all fresh installs):-

https://azure.microsoft.com/en-gb/documentation/articles/mobile-services-javascript-backend-phonegap-get-started/#make-app-updates-and-rebuild-projects-for-each-platform

You download the project to run in eclipse then when you try to run it in Eclipse it says "Cannot run selection" with no firther information ... not very helpful at all.

The only issue I can see seems to be a missing config.xml ... why wouild that be missing?

So silly when the simple demo app doesn't even run out of the box? 

PullAsync stack overflow exception.

$
0
0

Hello,

When I try to PullAsync a table with 180 fields I am getting a stack overflow exception at the server side. Debugging shows that the exception is raised after the controller has returned the data from the GetAll() method. 

A stack trace is not reported by Visual Studio. The only information I found is that the threads window shows that the server thread is in the following call: 
System.Core.dll!System.Linq.Enumerable.WhereSelectEnumerableIterator<SyncPocService.DataObjects.TestItem, System.Web.Http.OData.Query.Expressions.SelectExpandBinder.SelectSome<SyncPocService.DataObjects.TestItem>>.MoveNext

It works fine when I reduce the number of fields to e.g. 150. Testing shows out that it does not matter which fields are removed. It has definitely something to do with the number of fields. 

Any help would be appreciated.

Regards,
Bert

Unable to find the MonoDB Connection String

$
0
0

Hi Team,

I am trying to migrate from Parse to Azure, but I am unable to understand what is MongoDB Connection String, How to find it for my app?

I am trying to import the app from Deploy to Azure button in GITHUB.

How to create Mobile App server project from VisualStudio

$
0
0
Hi, I'm new to Azure and cloud in general, I tried to create a Mobile App from the portal and that worked well. Now I'm trying from VisualStudio 2015 using the templates that come along with the Azure SDK, I created a mobile App, gave some classes as model and deployed it successfully, how ever if I check on the portal, I can't find any database attached/added to it ? How can I do that directly from Visual Studio, or I must do it on the portal, and if yes how ?

Mobile Service serving static pages along with REST APIs

$
0
0

I have a basic question and didn't really found information in documentation.

I have a mobile app service setup created which serves basic Todo Item table REST API's and Custom API's which works great, I was able to use "try it out" and started wondering what if I want to create a WebClient using AngularJs along with all mobile client apps using Cordova. Client apps, I understand they get installed in Local how about webclient where should I really put that. when I login and started editing usingMonaco - https://mobileservice.scm.azure-mobile.net/dev/wwwroot and addedIndex.html >> did git commit >> changes got saved but when I refresh my screen I don't see it being picked up and displayed as static page.

what is the best approach to do it !?

can we host mobile services and AngularJs WebClient in same host space like when visitors visit - www.customdomain.com it should load index.html and www.customdomain.com/help should load API's Documentation

Reply much appreciated.


Regards Nagendra Rao Jogi.


Can't complete the "Create an iOS app" tutorial

$
0
0

Hi,

I am trying out the Azure iOS setup using the "Create an iOS app" tutorial: https://azure.microsoft.com/en-us/documentation/articles/app-service-mobile-ios-get-started/

I managed to setup the service as instructed, but right at the end, when I get to the "Download and run the iOS app" part, I get stuck. The "QuickStart > iOS (Objective-c)" page does have a Download button, but on clicking it, nothing happens. The button becomes selected for 5-10 seconds, but nothing gets downloaded, not popup with a link or anything comes up, and then the button goes back to the unselected state. 

Hope someone can help me out soon.

Thanks.


[UWP] Offline Sync - Updating an item that's been deleted

$
0
0

I've encountered a scenario where on one device, an item was deleted. But on another device, that same item has a local pending update. Syncing in this scenario fails and I am not sure how to handle it.

My SyncHandler looks like this:

public virtual async Task<JObject> ExecuteTableOperationAsync(IMobileServiceTableOperation operation)
        {
            MobileServiceInvalidOperationException error;
            Func<Task<JObject>> tryOperation = operation.ExecuteAsync;
            do
            {
                error = null;
                try
                {
                    JObject result = await operation.ExecuteAsync();
                    return result;
                }
                catch (MobileServiceConflictException ex)
                {
                    error = ex;
                    operation.AbortPush();
                }
                catch (MobileServicePreconditionFailedException ex)
                {
                    error = ex;
                    operation.AbortPush();
                }
                catch (MobileServiceInvalidOperationException ex)
                {
                    error = ex;
                    string message = ex.Message;
                    string helpLink = ex.HelpLink;
                    string reasonPhrase = ex.Response.ReasonPhrase;
                    operation.AbortPush();
                }
                //catch (WebException ex)
                //{
                //    operation.AbortPush();

                //}
                catch (Exception e)
                {
                    Debug.WriteLine(e.ToString());
                    operation.AbortPush();
                    //throw e;
                }

                if (error != null)
                {
                    //Not sure how to delete the item!
                }
            }
        }

Any help is appreciated, thanks!


Can't create mobile service via CLI (application already exists)

$
0
0

I've been testing out my Azure Mobile Services deployment script and I've run into an error I cannot get around. While running the "azure mobile create" command I get the following error:

Creating mobile service bogus-paalp-dispatch-ms01
info:    Executing command mobile create
+ Registering for mobile services
+ Creating mobile service
error:   <Error xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><Code>ConflictError</Code><Message>The application already exists.</Message></Error>
info:    Error information has been recorded to C:\Users\Jeremy\.azure\azure.err
error:   mobile create command failed

However, there is no trace of it in either management portal or via "azure mobile list". 

More specifics to the scenario. I've been developing an environment provisioning script to build out our environment. Part of that environment includes six classic mobile services. I'm using the azure cli to accomplish this. I have a separate script that deletes those services (again via azure cli) so that I can test my scripts again. Everything was working fine for the first 20 or so times, but suddenly I get this error *for only one of the six services*. The other services continue to delete and create as expected. I cannot find what's causing the error. Anyone come up against this before?

Azure Notification Hub not producing toast through REST API.

$
0
0

To get around an issue with unmanaged code, I've tried sending toasts through the REST API, but I don't get the notification. The server just applies "Created". Can someone please tell me what I'm doing wrong here?

using System;
using System.IO;
using System.Net;
using System.Security.Cryptography;
using System.Text;

namespace ConsoleTest
{
    class Program
    {
        static void Main(string[] args)
        {
            var hub = new NotificationHub();
            hub.SendToast();
            Console.ReadLine();
        }
    }

    public class NotificationHub
    {
        private const string ApiVersion = "?api-version=2014-09";
        private const string AuthHeader = "Authorization";
        private const string ContentType = "application/atom+xml;type=entry;charset=utf-8";

        static string HubName { get; set; }
        static string ConnectionString { get; set; }
        static string Endpoint { get; set; }
        static string SasKeyName { get; set; }
        static string SasKeyValue { get; set; }
        static string Payload { get; set; }

        public NotificationHub()
        {
            HubName = "hgwhub";
            ConnectionString = "DELETED";
            ParseConnectionInfo();
        }

        public void SendToast()
        {
            var payload = @"<toast><visual><binding template = ""ToastText01""><text id = ""1"">Test message from console app</text></binding></visual></toast>";

            var uri = new Uri(Endpoint + HubName + "/messages" + ApiVersion);

            var sendRequest = WebRequest.CreateHttp(uri);
            sendRequest.Method = "POST";
            sendRequest.ContentType = ContentType;
            sendRequest.Headers[AuthHeader] = GenerateSaSToken(uri);

            byte[] byteArray = Encoding.UTF8.GetBytes(payload);
            sendRequest.ContentLength = byteArray.Length;

            Stream dataStream = sendRequest.GetRequestStream();
            dataStream.Write(byteArray, 0, byteArray.Length);
            dataStream.Close();

            WebResponse response = sendRequest.GetResponse();
            Console.WriteLine(((HttpWebResponse)response).StatusDescription);
            dataStream = response.GetResponseStream();
            StreamReader reader = new StreamReader(dataStream);
            string responseFromServer = reader.ReadToEnd();
            Console.WriteLine(responseFromServer);
            reader.Close();
            dataStream.Close();
            response.Close();
        }


        // From http://msdn.microsoft.com/en-us/library/dn495627.aspx
        private static void ParseConnectionInfo()
        {
            if (string.IsNullOrWhiteSpace(HubName))
            {
                throw new InvalidOperationException("Hub name is empty");
            }

            var parts = ConnectionString.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries);

            if (parts.Length != 3)
            {
                throw new InvalidOperationException("Error parsing connection string: " + ConnectionString);
            }

            foreach (var part in parts)
            {
                if (part.StartsWith("Endpoint"))
                {
                    Endpoint = "https" + part.Substring(11);
                }
                else if (part.StartsWith("SharedAccessKeyName"))
                {
                    SasKeyName = part.Substring(20);
                }
                else if (part.StartsWith("SharedAccessKey"))
                {
                    SasKeyValue = part.Substring(16);
                }
            }
        }

        private static string GenerateSaSToken(Uri uri)
        {
            var targetUri = WebUtility.UrlEncode(uri.ToString().ToLower()).ToLower();

            var expiresOnDate = Convert.ToInt64(DateTime.UtcNow.Subtract
                (new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds) + 60 * 60;
            var toSign = targetUri + "\n" + expiresOnDate;

            var keyBytes = Encoding.UTF8.GetBytes(SasKeyValue);
            var mac = new HMACSHA256(keyBytes);
            mac.Initialize();
            var rawHmac = mac.ComputeHash(Encoding.UTF8.GetBytes(toSign));
            var signature = WebUtility.UrlEncode(Convert.ToBase64String(rawHmac));

            var token = "SharedAccessSignature sr=" + targetUri + "&sig="+ signature + "&se=" + expiresOnDate + "&skn=" + SasKeyName;
            return token;
        }

    }

}

PS! I've removed the connection string, but the rest is all there.

TIA!

Dennis

Azure mobile app quickstart issue

$
0
0

Please,

My trouble is already posted in stackoverflow, and i will really apreciate if someone could see there.

http://stackoverflow.com/questions/35344691/azure-mobile-app-quickstart-trouble

Att


Viewing all 3756 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>