A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.databricks.com/aws/en/dev-tools/auth/oauth-federation-policy below:

Configure a federation policy | Databricks Documentation

Configure a federation policy

Databricks OAuth token federation enables you to securely access Databricks APIs using tokens from your identity provider (IdP). To enable OAuth token federation, you must configure a federation policy, either as Databricks account-wide or for workloads.

This article describes how to create and configure an OAuth token federation policy.

note

You cannot create a federation policy using the Databricks CLI in the Databricks workspace web terminal.

Account-wide token federation​

Account admins can configure OAuth token federation in the Databricks account using an account federation policy. An account federation policy enables all users and service principals in your Databricks account to access Databricks APIs using tokens from your identity provider. An account federation policy specifies:

For example, given the following account federation policy:

issuer: "https://idp.mycompany.com/oidc"
audiences: ["databricks"]
subject_claim: "sub"

This JWT body can be used to authenticate to Databricks as username@mycompany.com:

JSON

{
"iss": "https://idp.mycompany.com/oidc",
"aud": "databricks",
"sub": "username@mycompany.com"
}
Configure an account federation policy​

To configure an account federation policy, you must specify:

Account admins can configure an account federation policy using the Databricks CLI (version 0.239.0 and above) or the Databricks API. You can specify up to 20 account federation policies in your Databricks account.

  1. Install or update to the newest version of the Databricks CLI.

  2. As an account admin, authenticate to your Databricks account using the CLI. Specify the ACCOUNT_CONSOLE_URL and your Databricks ACCOUNT_ID.

    Bash

    databricks auth login --host ${ACCOUNT_CONSOLE_URL} --account-id ${ACCOUNT_ID}
  3. Create the account federation policy. For example:

    Bash

    databricks account federation-policy create --json \
    '{
    "oidc_policy": {
    "issuer": "https://idp.mycompany.com/oidc",
    "audiences": [
    "databricks"
    ],
    "subject_claim": "sub"
    }
    }'

The following is an example Databricks REST API call to create an account federation policy:

Bash

curl --request POST \
--header "Authorization: Bearer $TOKEN" \
"https://accounts.cloud.databricks.com/api/2.0/accounts/${ACCOUNT_ID}/federationPolicies" \
--data '{
"oidc_policy": {
"issuer": "https://idp.mycompany.com/oidc",
"audiences": [
"databricks"
],
"subject_claim": "sub"
}
}'
Example account federation policies​

The following table provides example account federation policies and the matching JWT body.

Workload identity federation​

Workload identity federation allows your automated workloads running outside of Databricks to access Databricks APIs without the need for Databricks secrets. Account admins can configure workload identity federation using a service principal federation policy.

A service principal federation policy is associated with a service principal in your Databricks account, and specifies:

For example, given the following service principal federation policy for a Github Actions workload:

issuer: "https://token.actions.githubusercontent.com"
audiences: ["https://github.com/my-github-org"]
subject: "repo:my-github-org/my-repo:environment:prod"

This JWT body can be used to authenticate to Databricks:

JSON

{
"iss": "https://token.actions.githubusercontent.com",
"aud": "https://github.com/my-github-org",
"sub": "repo:my-github-org/my-repo:environment:prod"
}
Configure a service principal federation policy​

To configure a service principal federation policy, you must specify:

Account admins can configure a service principal federation policy using the Databricks CLI (version 0.239.0 and above) or the Databricks API. You can create up to 20 service principal federation policies per Databricks service principal.

  1. Install or update to the newest version of the Databricks CLI.

  2. As an account admin, authenticate to your Databricks account using the CLI. Specify the ACCOUNT_CONSOLE_URL and your Databricks ACCOUNT_ID:

    Bash

    databricks auth login --host ${ACCOUNT_CONSOLE_URL} --account-id ${ACCOUNT_ID}
  3. Get the numeric ID of the service principal that will have the federation policy applied to it. (For example, 3659993829438643.)

    If you know the service principal application ID (typically a GUID value, such as bc3cfe6c-469e-4130-b425-5384c4aa30bb) in advance, you can then determine the service principal numeric ID using the Databricks CLI:

    Bash

    databricks account service-principals list --filter 'applicationId eq "<service-principal-application-id>"'
  4. Create the service principal federation policy. Here is an example of creating a federation policy for a GitHub Action:

    Bash

    databricks account service-principal-federation-policy create ${SERVICE_PRINCIPAL_NUMERIC_ID} --json \
    '{
    "oidc_policy": {
    "issuer": "https://token.actions.githubusercontent.com",
    "audiences": [
    "https://github.com/my-github-org"
    ],
    "subject": "repo:my-github-org/my-repo:environment:prod"
    }
    }'
  1. Get the numeric ID of the service principal that will have the federation policy applied to it, for example, 3659993829438643. If you know the service principal application ID (typically a GUID value, such as bc3cfe6c-469e-4130-b425-5384c4aa30bb) in advance, you can then determine the service principal numeric ID using the Databricks service principal REST API:

    Bash

    curl --get \
    --header "Authorization: Bearer $TOKEN" \
    "https://accounts.cloud.databricks.com/api/2.0/accounts/${ACCOUNT_ID}/scim/v2/ServicePrincipals" \
    --data-urlencode 'filter=applicationId eq "<service-principal-application-id>"'

    The service principal numeric ID is returned in the id field of the response.

  2. Create the service principal federation policy. Here is an example of creating a federation policy for a GitHub Action:

    Bash

    curl --request POST \
    --header "Authorization: Bearer $TOKEN" \
    "https://accounts.cloud.databricks.com/api/2.0/accounts/${ACCOUNT_ID}/servicePrincipals/${SERVICE_PRINCIPAL_NUMERIC_ID}/federationPolicies" \
    --data '{
    "oidc_policy": {
    "issuer": "https://token.actions.githubusercontent.com",
    "audiences": [
    "https://github.com/my-github-org"
    ],
    "subject": "repo:my-github-org/my-repo:environment:prod"
    }
    }'
Example Databricks service principal federation policies​

The following table provides example service principal federation policies and the matching JWT body.

For complete configuration steps for enabling workload identity federation for some of these common identity providers, see Enable workload identity federation in CI/CD.

Next steps​

After you have configured a federation policy for your account:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4