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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
kellyzhai
Frequent Visitor

App owns data AAD accessToken run in Object reference not set to an instance of an object.

Follow the instuction

https://docs.microsoft.com/en-us/power-bi/developer/embed-sample-for-customers

use Embedding setup tool to download the sample code, run below error all the time.

Server Error in '/' Application.


Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 343:                // Authentication using master user credentials
Line 344:                var credential = new UserPasswordCredential(Username, Password);
Line 345:                authenticationResult = await authenticationContext.AcquireTokenAsync(ResourceUrl, ApplicationId, credential).ConfigureAwait(false);Line 346:
Line 347:            }


Source File: C:\PowerBI-Developer-Samples\App Owns Data\PowerBIEmbedded_AppOwnsData\Services\EmbedService.cs    Line: 345

1 REPLY 1
Jayendran
Solution Sage
Solution Sage

Hi @kellyzhai 

 

Check your authenticationContext . I think either authenticationContext or ResourceUrl, ApplicationId, credential is beign passing as null

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.

Users online (112)