简体   繁体   中英

Embed power BI Report into an website using MVC

I am new to Power BI API and following the below link to embed a power BI report in an website that uses a .NETSDK.

embed sample for customers

I am an Azure active directory user and I have downloaded power BI using my active directory account. I followed embedding setup tool to setup an application as Native user and get the application id to be used for API calls. One of my team member designed a power BI report and published the workspace sharing with me. My AuthenticationType is MasterUser. I downloaded the sample application available in GitHub as mentioned in the above tutorial. I have been made an admin for my power BI pro account and trying to integrate the report in the website. I replaced the credentials and other ids as as described in the tutorial. But this gives me the following error-

unknown_user_type: Unknown User Type

This is the piece of code that's failing during AquireTokenAsync call.

private async Task<AuthenticationResult> DoAuthentication()
    {
        AuthenticationResult authenticationResult = null;
        if (AuthenticationType.Equals("MasterUser"))
        {
            var authenticationContext = new AuthenticationContext(AuthorityUrl);

            // Authentication using master user credentials
            var credential = new UserPasswordCredential(Username, Password);
            authenticationResult = authenticationContext.AcquireTokenAsync(ResourceUrl, ApplicationId, credential).Result;
        }

        return authenticationResult;
    }

Please help me solve this. Thanks in advance.

As noted in this thread , you must be an admin of the workspace you are trying to embed. Using a AAD user that is only a member of the workspace for embedding will cause this error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM