Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I get the error on my browser, while trying to run my .NET MVC App.
OptionsValidationException: IDW10106: The Instance option must be provided
I have followed the PowerBI Developer in a Day Tutorial to get this setup. There are no errors showing up in my code. Any guidance on where to look for errors. This is how my Program.cs and Startup.cs file looks like.
Program.cs
var builder = WebApplication.CreateBuilder(args);
var startup = new SalesReporting.Startup(builder.Configuration);
startup.ConfigureServices(builder.Services);
// Add services to the container.
builder.Services.AddControllersWithViews();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
app.Run();
Startup.cs
using Microsoft.Identity.Web;
using PowerBiEmbed.Services;
namespace SalesReporting
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
string[] scopes = new string[] { PowerBiApiService.PowerBiDefaultScope };
services.AddMicrosoftIdentityWebAppAuthentication(Configuration)
// Enable token acquisition from ITokenAcquisition
.EnableTokenAcquisitionToCallDownstreamApi(scopes)
// Enable token caching
.AddInMemoryTokenCaches();
// Allow injecting the custom class in controllers
services.AddScoped(typeof(PowerBiApiService));
}
}
}
Solved! Go to Solution.
This is how my appsettings.json file is setup. I have just masked the values.
{
"AzureAd": {
"Instance": "https://login.microsoftonline.com/",
"Domain": "*****",
"TenantId": "*****",
"ClientId": "*****",
"ClientSecret": "*****"
},
"PowerBI": {
"ServiceRootUrl": "https://api.powerbi.com",
"WorkspaceId": "*****"
},
"CurrentUser": {
"Region": ""
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
This is how my appsettings.json file is setup. I have just masked the values.
{
"AzureAd": {
"Instance": "https://login.microsoftonline.com/",
"Domain": "*****",
"TenantId": "*****",
"ClientId": "*****",
"ClientSecret": "*****"
},
"PowerBI": {
"ServiceRootUrl": "https://api.powerbi.com",
"WorkspaceId": "*****"
},
"CurrentUser": {
"Region": ""
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.