in aspnet/Microsoft.Samples.XMLA.HTTP/Microsoft.Samples.XMLA.HTTP.Proxy/Config.cs [12:53]
public Config(IConfiguration configSrc, ILogger<Config> logger)
{
this.Server = configSrc.GetValue<string>("Server");
this.DefaultDatabase = configSrc.GetValue<string>("DefaultDatabase");
this.TenantId = configSrc.GetValue<string>("TenantId");
if (string.IsNullOrEmpty(Server))
{
throw new InvalidOperationException("Required Config value Server is missing.");
}
if (string.IsNullOrEmpty(DefaultDatabase))
{
throw new InvalidOperationException("Required AppSettings Database is missing.");
}
if (string.IsNullOrEmpty(TenantId))
{
throw new InvalidOperationException("Required AppSettings TenantId is missing.");
}
if (Uri.TryCreate(Server, UriKind.Absolute, out Uri serverUri))
{
if (serverUri.Scheme == "powerbi")
{
ResourceId = "https://analysis.windows.net/powerbi/api";
}
else if (serverUri.Scheme == "asazure")
{
ResourceId = "https://*.asazure.windows.net";
}
else
{
throw new InvalidOperationException($"Unexpected Server URI Scheme {serverUri.Scheme}");
}
}
else
{
IsSSAS = true;
}
logger.LogInformation($"Using ResourceId {ResourceId} for target endpoint {Server}");
}