How Do You Embed a Power BI Report Server Report Into an ASP Net Web Application?

//

Angela Bailey

In this tutorial, we will learn how to embed a Power BI Report Server report into an ASP.Net web application. Embedding a Power BI report allows you to seamlessly integrate the report into your application, providing users with interactive visualizations and data insights. Let’s get started!

Prerequisites

Before proceeding with the embedding process, make sure you have the following:

  • An ASP.Net web application
  • A Power BI Report Server report
  • Power BI Report Server URL
  • Power BI Report Server username and password

Step 1: Install Power BI SDK for ASP.Net

To embed a Power BI report in an ASP.Net web application, we need to install the Power BI SDK for ASP.Net. You can install it using NuGet Package Manager in Visual Studio. Open your project in Visual Studio and follow these steps:

  1. Right-click on your project in Solution Explorer.
  2. Select “Manage NuGet Packages”.
  3. In the NuGet Package Manager, search for “Microsoft.PowerBI.AspNet.Mvc”.
  4. Select the package and click on “Install”.

Step 2: Configure the Application to Use Power BI Report Server

Once you have installed the Power BI SDK, we need to configure our application to use the Power BI Report Server. Open your Web.config file and add the following configuration settings:

<configuration>
    <appSettings>
        <add key="PowerBIReportServerUrl" value="https://your-report-server-url.com/ReportServer"/>
        <add key="PowerBIReportServerUsername" value="your-username"/>
        <add key="PowerBIReportServerPassword" value="your-password"/>
    </appSettings>
</configuration>

Replace the values of the “PowerBIReportServerUrl”, “PowerBIReportServerUsername”, and “PowerBIReportServerPassword” keys with your actual Power BI Report Server URL, username, and password.

Step 3: Embedding the Power BI Report

Now that we have installed the Power BI SDK and configured our application, let’s embed the Power BI report into our ASP. Open your desired web page where you want to display the report and add the following code:

<div class="embed-container">
    @Html.PowerBI().Embed("Your-Report-ID")
</div>

Replace “Your-Report-ID” with the actual ID of your Power BI report that you want to embed. This ID can be obtained from the Power BI Report Server.

Step 4: Styling and Customization

The embedded report may require some styling and customization to match your application’s design. You can apply CSS styles to customize the appearance of the embedded report container or use JavaScript APIs provided by Power BI SDK for further customization.

Conclusion

Congratulations! You have successfully embedded a Power BI Report Server report into an ASP.

By following these steps, you can provide your users with interactive visualizations and data insights directly within your application. Happy reporting!

Discord Server - Web Server - Private Server - DNS Server - Object-Oriented Programming - Scripting - Data Types - Data Structures

Privacy Policy