astro-panda / blazor-powerbi

An easy-to-use Razor Class Library for embedded Power BI reports
MIT License
5 stars 3 forks source link

ClientId - Seems to not be getting set #4

Closed johnhbarrett closed 2 years ago

johnhbarrett commented 2 years ago

First off thanks for publishing this repo - nicely written.

I'm on a blazor wasm myself project and really like the way you've componentized the various aspects of rendering PBI in Blazor.

First off I'm simply running this project with any updates of modification to get it going before adapting slightly for wasm.

Unfortunately I'm seeing this exception the app.Run(); call is made:

ArgumentNullException: IDW10106: The 'ClientId' option must be provided. Microsoft.Identity.Web.MergedOptionsValidation.Validate(MergedOptions options)

My initial thoughts were I've not set the Azure App Registration up correctly of I 've messed up the appsettings.

I've turned off secrets while I try to work through it doubled checked everything in terms of guids being set correctly.

I'd be interested firstly if you have a success in the 'ClientId' being set?

My appsettings.json: image

Psypher9 commented 2 years ago

Hi and thanks for trying out the repo in addition to leaving a comment.

So the ClientId is still being set by the Microsoft Identity layer here AstroPanda.Blazor.PowerBI.Demo/Program.cs#L8-L9

If you're trying to set the Azure AD configuration you'll need to make sure you're grabbing the right configuration section.

However, I'm noticing now that the Demo app is targeting an AzureAd section. I think I just forgot to change it before pushing last time. I'm willing to bet that if you're trying to run the Demo app it's failing because of lines 8 and 9 in Program.cs

Psypher9 commented 2 years ago

One other thing I'd like to point out is that this project is originally set up to run in Blazor Server mostly because the configuration uses Client secrets and you're access your Power BI workspace as a Service Principal. It's not really recommended to keep those service principal secrets on the client.

However, we do have plans to break this a part a bit and provide some Web API middleware though so that the components can still run other Blazor WASM and have a quick wire-up with an API that contains the secrets but serves out the embedding tokens needed to show the report.

Please let me know if what I've mentioned is helpful! Good luck!

Psypher9 commented 2 years ago

By the way, we've been working on a getting started wiki in case you've not seen it yet.

Getting Started

If you find it helpful, I'd appreciate any feedback you've got!

johnhbarrett commented 2 years ago

Really appreciate the quick response - yes wasm does hold a few challenges but I've been following the steps outlined from a Microsoft YouTube channel on this very topic here. There no official repo for it but there is an unofficial one here.

I'll be sure to follow the wiki and feed back to you - thanks once again!