Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
I am looking to generate an access token that I can then utilize to edit/create datasets and reports in the power bi service. I came across this link but after attempting to use it I am getting the below error messages I am having problems resolving.
Can someone point me in the correct direction? Below is the code I've attempted to use and the error messages I am receiving.
using System;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
namespace walkthrough_push_data
{
class Program
{
private static string token = string.Empty;
static void Main(string[] args)
{
// Get an authentication access token
token = GetToken();
}
private static async Task<string> GetToken()
{
string clientID = "{Client_ID}"; // The client id that Azure AD created when you registered your client app.
string redirectUri = "https://login.live.com/oauth20_desktop.srf"; // RedirectUri you used when you register your app.
string resourceUri = "https://analysis.windows.net/powerbi/api"; // Resource Uri for Power BI API
string authorityUri = "https://login.microsoftonline.com/common/"; // OAuth2 authority Uri
AuthenticationContext authContext = new AuthenticationContext(authorityUri);
var result = await authContext.AcquireTokenAsync(resourceUri, clientID, new Uri(redirectUri));
Console.WriteLine(result.AccessToken);
Console.ReadLine();
return result.AccessToken;
}
}
}
Have you completed the app registration including asking for the right scope?
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 |