Skip to main content

Azure Active Directory (Day 12 of 31)

List of all posts from this series:

Short Description 
Azure Active Directory (Azure AD) is an identify management service offered by Microsoft over Azure. Can be used with success to identify and authenticate users in applications (that can be hosted on-premises on cloud).
This is a service that can be used by any company, from small one to large ones. Using Azure AD we can add single sign on functionality very easily.

Main Features 
Sign-sign on
Using Azure AD we can add and manage only one mechanism of authentication cross all our applications.
Users and Group management
We have the possibility to manage not only users and their rights, but also groups like in an on-premises AD.
Integration with on-premises Active Directory
Azure AD can be integrated very easily with on-premises version of AD. In this way we can sync both systems and manage only in one place our list of users and groups. The same auth. mechanism can be used for on-premises applications and cloud.
Default tenant
By default there is a default tenant in all Azure AD called “Default Directory”. By default the administrator of subscription will be administrators on this tenant.
Supported Protocols
The current version of Azure AD supports:

  • WS-Federation
  • SAML 2.0

Single sign-on endpoints
There are only one endpoint for each protocol that is used by all tenants to sign-on using Azure AD.
All configuration and management of Azure AD can be made over a RESTfull API.
Microsoft services
By default, there is a list of Microsoft services that are using Azure AD. On top of this we can extend it and add other service. The list of services that are using Azure AD by default is:

  • Azure
  • Office 365
  • Windows Intune   
  • Dynamic CRM Online

Types of application that can used Azure AD
Any kind of application can use Azure AD for authentication from web application to mobile one or even Daemon and embedded.
Tenants’ types
There are two types of tenants that can be used:

  • Single tenant – is used for application that are used for your own organization
  • Multi tenant – is used for applications that are used by users that are not only from your organization

Session (token) management
We have full control of the session. For example we have the possibility to specify the token expiration time. When the token expire, the user will need to sign on again.
Multi-factor authentication
There is full support for multi-factor authentication. This features is out-of-the-box. You need only to activate it and it will work without any kind of problems.
Cross Platform
Azure AD works with any platform and device. We are not limited to use it only on some specific devices.
Self-service password reset 
Users had the ability to manage their password by themselves (and even reset the password).
Company branding 
The Azure AD auth. pages can be use customer logos and UI. In this way we can have custom UI.
Advanced Security Reports 
Azure AD is capable to generate complex security report that can be used by our IT and security team for audit.
Alerts Usage Reports Enterprise scale SLA 
We can define custom alerts based on our usage reports.

No multi-factor authentication for technologies that use Direct Access 
If you are using Direct Access, then you will not be able to use multi-factor authentication.
Office 365 and Live Accounts are not the same
If you migrate from live account to Office 365 you will end up with two different email address, one for Office 365 and another one for live. You don’t have the possibility to merge them (yet).

Applicable Use Cases 
Below you can find 4 use cases when I would use Azure AD.
Migrate from on-premises to Azure
When you start to migrate your applications from on-premises to Azure, you don’t need to recreate your AD structure into cloud. You can connect your on-premises AD to Azure AD and synchronize it. In this way you will do AD management in the same way you did before.
Single Sign-on
For new application I would try to use single sign-on functionality. Users can be managed more easily and when you extend your application you will be able to give access to the same users to new application also.
Secure application
For application where security is very important Azure AD and Multi-Factor authentication it is a have to. This two features combined allow us to create application that are very secure and reliable.
For large companies, Azure AD can help them to delegate different task to different groups of users. In this way we can create different groups of users that have different management rights. In this the management of users can be made more easily.

Code Sample 
For a full code samples, related to all platform and features I recommend to you to check the fallowing GIT repository:
Using OWIN, we can do cool stuff on our web applications. Below you can see how simple the account controllers will be if you will use OWIN:
public class AccountController : Controller
        public void SignIn()
            // Send a WSFederation sign-in request.
            if (!Request.IsAuthenticated)
                HttpContext.GetOwinContext().Authentication.Challenge(new AuthenticationProperties { RedirectUri = "/" }, WsFederationAuthenticationDefaults.AuthenticationType);
        public void SignOut()
            // Send a WSFederation sign-out request.
                WsFederationAuthenticationDefaults.AuthenticationType, CookieAuthenticationDefaults.AuthenticationType);

Pros and Cons 

  • Easy to use
  • Integrated with on-premises AD
  • Multi-Factor Authentication
  • Management portal is not very intuitive

There are 3 types of tiers that are offered in this moment (Free, Basic, and Premium). For the last two of them we don’t have kind of limitations related to number of users. When you are thinking to migrate or move to Azure AD you should take into account:

  • Number of users
  • Number of applications that will be used per user
  • Type of service agreement
  • Number of users that will use multi-factor authentication 

In conclusion we can say that Azure AD is a powerful service that is already part of Azure core. It is a service that is here to stay. Azure AD should be the first option when we are thinking about security and user management in cloud.


Popular posts from this blog

ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded

Today blog post will be started with the following error when running DB tests on the CI machine:
threw exception: System.InvalidOperationException: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See for more information. at System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantName) This error happened only on the Continuous Integration machine. On the devs machines, everything has fine. The classic problem – on my machine it’s working. The CI has the following configuration:

TeamCity.NET 4.51EF 6.0.2VS2013
It seems that there …

Entity Framework (EF) TransactionScope vs Database.BeginTransaction

In today blog post we will talk a little about a new feature that is available on EF6+ related to Transactions.
Until now, when we had to use transaction we used ‘TransactionScope’. It works great and I would say that is something that is now in our blood.
using (var scope = new TransactionScope(TransactionScopeOption.Required)) { using (SqlConnection conn = new SqlConnection("...")) { conn.Open(); SqlCommand sqlCommand = new SqlCommand(); sqlCommand.Connection = conn; sqlCommand.CommandText = ... sqlCommand.ExecuteNonQuery(); ... } scope.Complete(); } Starting with EF6.0 we have a new way to work with transactions. The new approach is based on Database.BeginTransaction(), Database.Rollback(), Database.Commit(). Yes, no more TransactionScope.
In the followi…

GET call of REST API that contains '/'-slash character in the value of a parameter

Let’s assume that we have the following scenario: I have a public HTTP endpoint and I need to post some content using GET command. One of the parameters contains special characters like “\” and “/”. If the endpoint is an ApiController than you may have problems if you encode the parameter using the http encoder.
using (var httpClient = new HttpClient()) { httpClient.BaseAddress = baseUrl; Task<HttpResponseMessage> response = httpClient.GetAsync(string.Format("api/foo/{0}", "qwert/qwerqwer"))); response.Wait(); response.Result.EnsureSuccessStatusCode(); } One possible solution would be to encode the query parameter using UrlTokenEncode method of HttpServerUtility class and GetBytes method ofUTF8. In this way you would get the array of bytes of the parameter and encode them as a url token.
The following code show to you how you could write the encode and decode methods.