First published on MSDN on Nov 30, 2016
The C# code samples attached in the zip file below present a solution for the front-mid tier architecture allowing client applications to use individual Azure AD user credentials to connect to SQL DB/DW using mid-tier WEB app “on-behalf of token” obtained from Azure AD by redeeming individual user’s access token. This solution represents a standard configuration for client applications accessing the database using Azure AD authentication and a mid-tier WEB app as the main node communicating with the database.
For more information on Azure AD authentication with SQL DB/DW see https://docs.microsoft.com/en-us/azure/sql-database/sql-database-aad-authentication .

The attached zip file contains an extensive README file describing the whole setup process step-by-step.
Download the zip file below.