public async Task <string> GetAsync(ModelConfiguration model, CancellationToken cancellationToken = default) { var clientId = model.Authentication.AnalysisServicesClientId; var clientSecret = model.Authentication.AnalysisServicesClientSecret; var credential = await _credentialFactory.Create(model.Authentication) .GetAsync(clientId, clientSecret, cancellationToken); return ($"Data Source={model.ServerName};User ID=app:{credential.Username}@{model.Authentication.DirectoryId};Password={credential.Password};"); }
public async Task <string> GetAsync(ModelConfiguration model, CancellationToken cancellationToken = default) { var clientId = model.Authentication.AnalysisServicesClientId; var clientSecret = model.Authentication.AnalysisServicesClientSecret; var credential = await _credentialFactory.Create(model.Authentication) .GetAsync(clientId, clientSecret, cancellationToken); var authority = $"https://login.microsoftonline.com/{model.Authentication.DirectoryId}"; const string resource = "https://*.asazure.windows.net/"; var token = await _tokenFactory.Create(credential, authority, resource) .GetAsync(cancellationToken); return($"Data Source={model.ServerName};Password={token.AccessToken};Provider=MSOLAP;"); }
private async Task <Credential> GetCredential(ModelConfiguration model, CancellationToken cancellationToken) { var username = model.DataSource.Username; var password = model.DataSource.Password; var credential = await _credentialFactory.Create(model.Authentication) .GetAsync(username, password, cancellationToken); return(new Credential { AuthenticationKind = AuthenticationKind.UsernamePassword, Password = credential.Password, Username = credential.Username }); }
private async Task <Token> GetSqlServerToken(ModelConfiguration model, CancellationToken cancellationToken) { var username = model.DataSource.Username; var password = model.DataSource.Password; var credential = await _credentialFactory.Create(model.Authentication) .GetAsync(username, password, cancellationToken); var authority = $"https://login.windows.net/{model.Authentication.DirectoryId}"; const string resource = "https://database.windows.net/"; var token = await _tokenFactory.Create(credential, authority, resource) .GetAsync(cancellationToken); _logger.Info("Retrieved SQL Server authentication token."); return(token); }