Showing posts with label azure. Show all posts
Showing posts with label azure. Show all posts

Saturday, April 8, 2017

Hands on Xamarin Platform Pipeline - Develop - Exploring Visual Studio Mobile Center

In this post we'll explore the functionalities of the Visual Studio Mobile Center, it's just an overview and each functionality will be detailed in future posts while improving our 'RememberIt' application.

Don't forget to take a look at the previous posts.

Visual Studio Mobile Center helps mobile developers to cover all the lifecycle (Continuous Integration and Continuous Delivery) and the functionalities they need for a mobile application. It's available under the following link: https://mobile.azure.com

Application creation

Let's create our 'RememberIt' application is Visual Studio Mobile Center. Firstly, login to https://mobile.azure.com, then push 'Add new app' button.
Enter app name and for our 'RememberIt' application select Android as OS, Xamarin as platform then push 'Add new app' button.
Once the application created, the getting started page is shown.

Exploring Visual Studio Mobile Center menus

Build menu: to retrieve the code from either GitHub repository or Bitbucket then configure an automatic build of the project.
Test menu: it's for UI automation tests, we can chose the device configuration and plan UI testing after the build step.
Distribute menu: for distribution and where we can define group of testers and configure an automatic distribution to that group after a successful build.
Tables menu: is for managing the storage of the mobile application. 
Identity menu: is for adding authentication to the mobile application and the following providers are supported:
- Azure Active Directory
- Microsoft account
- Facebook
- Google
- Twitter
Crashes menu: is for crash data browsing of the mobile application.
Analytics menu: is for mobile application analytics data browsing.

Monday, April 3, 2017

Hands on Xamarin Platform Pipeline - Develop - Add authentication using Azure Active Directory

After creating an offline application following the previous post.

Now, we will start convert our offline application to a connected one using Microsoft Azure tools. In this post we'll add authentication using Azure Active Directory.

Application Creation on Azure Active Directory

To do this, login to https://manage.windowsazure.com and in case you don't have Azure Subscription a trial can be requested. Then, click on Active Directory as shown in the image below.
Select an Active Directory, navigate to Applications tab, click ‘Add‘ button then select ‘Add an application my organization is developing‘.
Choose an application name and make sure to select ‘Native Client Application‘ as type of application.
On the final screen, provide the ‘Redirect URI‘ then validate the application creation.
Once the app is created, navigate to ‘Configure‘ tab then write down the ‘Client ID’ that we’ll use later.

User Creation on Active Directory

In Active Directory main screen, navigate to Users tab, click on Add User button then chose a user name, in my case the user name shall be: test@anasehhotmail.onmicrosoft.com
Fill in some information about the user.
At the last step generate a temporary password that we can use for the first authentication in order to chose the final password.

Update the mobile Application

Add the package named Azure Active Directory Authentication Library (Azure ADAL) to the application.
Add a button to the Main.axml layout, we can use the Android graphical designer.
In the MainActivity class add the following constants.

Now, invoke the authentication process then save the result to authResult variable.

Finally, override the OnActivityResult method to get the authentication result.

Below some screenshots.
 

Complete source code can be found on Github.

See you soon!