Skip to content

Commit

Permalink
List profiles with all auth methods (#1027)
Browse files Browse the repository at this point in the history
## Changes

JS SDK now supports all auth methods so we no longer have to filter out
unsupported auth methods.
With the bump of the SDK this PR also adds support for Databricks OAuth
U2M on Azure and GCP.

## Tests

Manually tests
  • Loading branch information
fjakobs authored Feb 2, 2024
1 parent abaa30b commit 41ca392
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
6 changes: 5 additions & 1 deletion packages/databricks-vscode/src/cli/CliWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ export class CliWrapper {
return [];
}

const profiles = JSON.parse(res.stdout).profiles || [];
let profiles = JSON.parse(res.stdout).profiles || [];

// filter out account profiles
profiles = profiles.filter((p: any) => !p.account_id);

const result = [];

for (const profile of profiles) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,7 @@ async function listProfiles(cliWrapper: CliWrapper) {
}
});

return profiles.filter((profile) => {
return [
"pat",
"basic",
"azure-cli",
"oauth-m2m",
"azure-client-secret",
].includes(profile.authType);
});
return profiles;
}

async function validateDatabricksHost(
Expand All @@ -243,11 +235,11 @@ async function validateDatabricksHost(

function authMethodsForHostname(host: URL): Array<AuthType> {
if (isAzureHost(host)) {
return ["azure-cli", "profile"];
return ["databricks-cli", "azure-cli", "profile"];
}

if (isGcpHost(host)) {
return ["google-id", "profile"];
return ["databricks-cli", "google-id", "profile"];
}

if (isAwsHost(host)) {
Expand Down

0 comments on commit 41ca392

Please sign in to comment.