Overview
In this article, we will learn how we can Embed Power BI reports using ASP.Net SDK.
In my previous articles, we talked about how to Embed reports using Power BI JavaScript API.
Before we start, please visit my previous articles.
Now, let’s get started!
- The first step is to register your Power BI app on Azure Portal. I already have mentioned these steps in my previous article. Visit the following URL for app registration.
- Now, download the sample code from the GitHub for Power BI Embed using the following URL. I have also attached the sample code with this article.https://github.com/Microsoft/PowerBI-Developer-Samples

- We will use “Apps own Data” folder.
- Open the Visual Studio solution. It will look like the following.

- Now, Open web.config file. Change the value of the following keys.
Change the following keys, - clientId = Client Id of the application we have registered in Azure
- groupId = Workspace Id of Power BI report
- reportId = Report Id of Power BI report
- pbiUsername = Power BI Pro username
- pbiPassword = Password of your Power BI Pro account
Refer to the following image for these keys.
![]()
6. Open “HomeController.cshtml” and Run the code. It will open the Output Page. Click on Embed Report.
7. The report will look like the following screen.
![]()
This is how we can embed our Power BI report using ASP.NET SDK.
Conclusion
This is how we can embed our Power BI report using ASP.NET SDK. Isn’t it amazing! Stay connected with me.

Mohamed rafeequePosted Dec 28, 2024, 7:03 AM
I am getting the below error System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)
harish kumarPosted May 11, 2020, 11:13 PM
I am getting below error while connecting to Power BI: Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException: AADSTS65001: The user or administrator has not consented to use the application with ID '9bce039a-2273-4413-85a5-3aed52705394' named 'Test Apps'. Send an interactive authorization request for this user and resource.Trace ID: 99d5b630-1b20-4c3e-8518-4007dae67400. Please help to resolve this.
Rawan ALJaburPosted Jul 25, 2019, 4:55 AM
While i am trying to run my application and click on "Embed Report" i get error Microsoft.IdentityModel.Clients.ActiveDirectory.AdalException: authority_validation_failed: Unknown error ---> Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException: Service returned error. Check InnerException for more details ---> Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException: Request to the endpoint timed out. ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.