In the sample, steps 2 is using
Install-Package Microsoft.IdentityModel.Clients.ActiveDirectory -Version 2.21.301221612
In the newer ADAL v3, try a new sample
using Microsoft.IdentityModel.Clients.ActiveDirectory; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication32 { class Program { static void Main(string[] args) { string token = GetToken(); Console.WriteLine(token); Console.ReadLine(); } #region Get an authentication access token private static string GetToken() { // TODO: Install-Package Microsoft.IdentityModel.Clients.ActiveDirectory -Version 2.21.301221612 // and add using Microsoft.IdentityModel.Clients.ActiveDirectory //The client id that Azure AD created when you registered your client app. string clientID = "3f756axxxxxxx3662e"; //RedirectUri you used when you register your app. //For a client app, a redirect uri gives Azure AD more details on the application that it will authenticate. // You can use this redirect uri for your client app string redirectUri = "https://login.live.com/oauth20_desktop.srf"; //Resource Uri for Power BI API string resourceUri = "https://analysis.windows.net/powerbi/api"; //OAuth2 authority Uri string authorityUri = "https://login.windows.net/common/oauth2/authorize"; //Get access token: // To call a Power BI REST operation, create an instance of AuthenticationContext and call AcquireToken // AuthenticationContext is part of the Active Directory Authentication Library NuGet package // To install the Active Directory Authentication Library NuGet package in Visual Studio, // run "Install-Package Microsoft.IdentityModel.Clients.ActiveDirectory" from the nuget Package Manager Console. // AcquireToken will acquire an Azure access token // Call AcquireToken to get an Azure token from Azure Active Directory token issuance endpoint AuthenticationContext authContext = new AuthenticationContext(authorityUri); //string token = authContext.AcquireToken(resourceUri, clientID, new Uri(redirectUri)).AccessToken; return authContext.AcquireTokenAsync(resourceUri, clientID, new Uri(redirectUri), new PlatformParameters(0)).Result.AccessToken; } #endregion } }