Skip to content
프로젝트

소개

Power BI .NET 개발자 커뮤니티에 오신 것을 환영합니다. 여기에서 Power BI Embedded V2.0.0용 .NET SDK 리소스를 확인할 수 있습니다

학습 및 교육

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

Power BI REST APIs for .NET

Migration Guide

If you are migrating from version v4.22 to v5, please refer to the Migration Guide for detailed instructions and breaking changes.

Overview

The Power BI REST APIs provide service endpoints for embedding, user resources management, administration and governance.

For more information about Power BI REST APIs, see Power BI REST APIs overview.

Power BI API library

The Microsoft.PowerBI.Api library for .NET enables you to work with Power BI REST APIs in your .NET or NET Core application.

Install the NuGet package directly from the Visual Studio Package Manager console.

Visual Studio Package Manager

Install-Package Microsoft.PowerBI.Api

Creating the Power BI Client

The PowerBIClient can be created using either credentials or a Microsoft Entra Access Token.

Using Credentials

Authenticate by providing service principal credentials(client ID, client secret, and tenant ID) or username password credentials(client ID, tenant ID, username and password ).

For more details, see the Authentication Updates section in the migration guide.

Using Microsoft Entra Access Token

Alternatively, authenticate using a Microsoft Entra Access Token for secure, delegated access.

Examples

Below are basic examples demonstrating some of the most common capabilities of the SDK. Full examples including authentication are avaliable in PowerBI-Developer-Samples

Get the list of datasets and reports in a Power BI workspace

...
using (PowerBIClient client = new PowerBIClient(credentials or Microsoft Entra Access Token ))
{

    Console.WriteLine("\r*** DATASETS ***\r");

    // List of datasets in a workspace
    Datasets datasets = client.Datasets.GetDatasetsInGroup(groupId);

    foreach(Dataset ds in datasets.Value)
    {
        Console.WriteLine(ds.Id + " | " + ds.Name);
    }

    Console.WriteLine("\r*** REPORTS ***\r");

    // List of reports in a workspace
    Reports reports = client.Reports.GetReportsInGroup(groupId);

    foreach (Report rpt in reports.Value)
    {
        Console.WriteLine(rpt.Id + " | " + rpt.Name +  " | DatasetID = " + rpt.DatasetId);
    }
}
...

Creating an Embed Token to reports and datasets

Embed tokens are used to provide access to Power BI artifacts like reports and datasets to embed into an application. To create a report embed token you will need a Power BI Embedded capacity, and the Ids of the workspaces and artifacts to provide access to. For more information about Power BI Embedded visit the Power BI Embedded Analytics Playground

...
using (PowerBIClient client = new PowerBIClient(credentials or Microsoft Entra Access Token))
{
    // Create a request for getting Embed token
     var tokenRequest = new GenerateTokenRequestV2();
     tokenRequest.Datasets.Add(datasets);
     tokenRequest.Reports.Add(reports);
     tokenRequest.TargetWorkspaces.Add(workspaces);
     tokenRequest.Identities.Add(identities);

    // Get Embed token
    var embedToken = client.EmbedToken.GenerateToken(tokenRequest);
}
...

Get Reports As Admin

Returns a list of reports for the organization. The caller must have administrator rights.

...
using (PowerBIClient client = new PowerBIClient(credentials or Microsoft Entra Access Token))
{
    Console.WriteLine("\r*** REPORTS ***\r");

    // List of reports in the organization.
    AdminReports reports = client.Reports.GetReportsAsAdmin();

    foreach (AdminReport rpt in reports.Value)
    {
        Console.WriteLine(rpt.Id + " | " + rpt.Name);
    }
}
...

Additional links

관련 프로젝트 살펴보기

불러오는 중…