You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support Databricks Workload Identity Federation for GitHub tokens (#933)
## What changes are proposed in this pull request?
This PR adds support for Databricks Workload Identity Federation using
GitHub tokens. This allows users to use WIF from their GitHub Workflows
and authenticate their workloads without long lived secrets.
This new credentials strategy is added to the DefaultCredentialsStrategy
after the other Databricks Credentials Strategy and before cloud
specific authentication methods.
WIF credentials uses a subset of configuration values of other
Databricks authentication methods. By being added after them it ensures
that WIF is not used when other Databricks authentication methods are
configured.
WIF uses the Databricks client id, which is not used by cloud specific
authentication methods. Therefore, it will not be used when cloud
specific authentication methods are configured.
## How is this tested?
Added tests.
Copy file name to clipboardExpand all lines: NEXT_CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,10 @@
6
6
* Enabled asynchronous token refreshes by default. A new `disable_async_token_refresh` configuration option has been added to allow disabling this feature if necessary ([#952](https://github.com/databricks/databricks-sdk-py/pull/952)).
7
7
To disable asynchronous token refresh, set the environment variable `DATABRICKS_DISABLE_ASYNC_TOKEN_REFRESH=true` or configure it within your configuration object.
8
8
The previous `enable_experimental_async_token_refresh` option has been removed as asynchronous refresh is now the default behavior.
9
+
* Introduce support for Databricks Workload Identity Federation in GitHub workflows ([933](https://github.com/databricks/databricks-sdk-py/pull/933)).
10
+
See README.md for instructions.
11
+
*[Breaking] Users running their workflows in GitHub Actions, which use Cloud native authentication and also have a `DATABRICKS_CLIENT_ID` and `DATABRICKS_HOST`
12
+
environment variables set may see their authentication start failing due to the order in which the SDK tries different authentication methods.
Copy file name to clipboardExpand all lines: README.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -126,18 +126,18 @@ Depending on the Databricks authentication method, the SDK uses the following in
126
126
127
127
### Databricks native authentication
128
128
129
-
By default, the Databricks SDK for Python initially tries [Databricks token authentication](https://docs.databricks.com/dev-tools/api/latest/authentication.html) (`auth_type='pat'` argument). If the SDK is unsuccessful, it then tries Databricks basic (username/password) authentication (`auth_type="basic"` argument).
129
+
By default, the Databricks SDK for Python initially tries [Databricks token authentication](https://docs.databricks.com/dev-tools/api/latest/authentication.html) (`auth_type='pat'` argument). If the SDK is unsuccessful, it then tries Databricks Workload Identity Federation (WIF) authentication using OIDC (`auth_type="github-oidc"` argument).
130
130
131
131
- For Databricks token authentication, you must provide `host` and `token`; or their environment variable or `.databrickscfg` file field equivalents.
132
-
- For Databricks basic authentication, you must provide `host`, `username`, and `password`_(for AWS workspace-level operations)_; or `host`, `account_id`, `username`, and `password`_(for AWS, Azure, or GCP account-level operations)_; or their environment variable or `.databrickscfg`file field equivalents.
|`host`|_(String)_ The Databricks host URL for either the Databricks workspace endpoint or the Databricks accounts endpoint. |`DATABRICKS_HOST`|
137
-
|`account_id`|_(String)_ The Databricks account ID for the Databricks accounts endpoint. Only has effect when `Host` is either `https://accounts.cloud.databricks.com/`_(AWS)_, `https://accounts.azuredatabricks.net/`_(Azure)_, or `https://accounts.gcp.databricks.com/`_(GCP)_. |`DATABRICKS_ACCOUNT_ID`|
138
-
|`token`|_(String)_ The Databricks personal access token (PAT) _(AWS, Azure, and GCP)_ or Azure Active Directory (Azure AD) token _(Azure)_. |`DATABRICKS_TOKEN`|
139
-
|`username`|_(String)_ The Databricks username part of basic authentication. Only possible when `Host` is `*.cloud.databricks.com`_(AWS)_. |`DATABRICKS_USERNAME`|
140
-
|`password`|_(String)_The Databricks password part of basic authentication. Only possible when `Host` is `*.cloud.databricks.com`_(AWS)_. |`DATABRICKS_PASSWORD`|
132
+
- For Databricks OIDC authentication, you must provide the `host`, `client_id` and `token_audience`_(optional)_ either directly, through the corresponding environment variables, or in your `.databrickscfg`configuration file.
|`host`|_(String)_ The Databricks host URL for either the Databricks workspace endpoint or the Databricks accounts endpoint. |`DATABRICKS_HOST`|
137
+
|`account_id`|_(String)_ The Databricks account ID for the Databricks accounts endpoint. Only has effect when `Host` is either `https://accounts.cloud.databricks.com/`_(AWS)_, `https://accounts.azuredatabricks.net/`_(Azure)_, or `https://accounts.gcp.databricks.com/`_(GCP)_.|`DATABRICKS_ACCOUNT_ID`|
138
+
|`token`|_(String)_ The Databricks personal access token (PAT) _(AWS, Azure, and GCP)_ or Azure Active Directory (Azure AD) token _(Azure)_. |`DATABRICKS_TOKEN`|
139
+
|`client_id`|_(String)_ The Databricks Service Principal Application ID. |`DATABRICKS_CLIENT_ID`|
140
+
|`token_audience`|_(String)_When using Workload Identity Federation, the audience to specify when fetching an ID token from the ID token supplier. |`TOKEN_AUDIENCE`|
141
141
142
142
For example, to use Databricks token authentication:
0 commit comments