cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bytesizetrainer
New Member

OptionsValidationException: IDW10106: The Instance option must be provided

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));
        }
    }
}

 

 

 

1 ACCEPTED SOLUTION
bytesizetrainer
New Member

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": "*"
}

 

 

View solution in original post

1 REPLY 1
bytesizetrainer
New Member

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": "*"
}

 

 

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.