Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

View all the Fabric Data Days sessions on demand. View schedule

Reply
isthisworking
Microsoft Employee
Microsoft Employee

Acquire a token when PlatformParameters definition change migrating to .NET Core 3.1

Hi All,
 
I've run into a problem with a C# console app that (for reasons) is being moved from .NET Framework to .NET Core. In the process of retargeting the app, the following line of code to get the access token is no longer syntactically correct:
 
AuthenticationResult result =
    await m_authenticationContext.AcquireTokenAsync(
        resourceUri,
        clientID,
        new Uri(redirectUri),
        new PlatformParameters(PromptBehavior.Auto));
 
The constructor for PlatformParameters no longer accepts the single parameter. It now requires a second parameter of ICustomWebUi. The desired (and previous) behavior of the console app is that, when run, it does not require user interaction to authenticate. This needs to run headless. What would be the easiest method to refactor the code to maintain parity?
 
Thanks.

1 REPLY 1
michaelx2
Microsoft Employee
Microsoft Employee

Hello @isthisworking ,

The seconed parameter ICustomWebUi is extension method enabling ADAK.NET extenders for public client applications to set a custom web ui that will let the user sign-in with Azure AD, present consent if needed, and get back the authorization code.  You may refer to a sample implement here:

https://github.com/AzureAD/azure-activedirectory-library-for-dotnet/blob/66f89589b878c1a7cfb12e46f60... 

 

In your scenario, you want to run the app in headless mode, since that, you may try to use 3rd party library PowerBI.Api.Client  which already implemented Automatic OAuth2 authentication.

 

Best Regards

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors