databricks-sdk-py icon indicating copy to clipboard operation
databricks-sdk-py copied to clipboard

Added IdentityFederation property to Workspace

Open abij opened this issue 1 year ago • 1 comments

What changes are proposed in this pull request?

What: extra optional field on Workspace identity_federation_info

Why: I want to check if the Workspace is/was already connected to Unity, account-level. If workspace Identity federation is enabled I can fetch the permissions for example.

import os
from databricks.sdk import AccountClient

# Assume I have authenticated and stored as profile "ACCOUNT"
os.environ["DATABRICKS_CONFIG_PROFILE"] = "ACCOUNT"

a = AccountClient()
w = a.workspaces.get("387127*******")

if w.identity_federation_info:
    print(f"Identity Federation: {w.identity_federation_info.enable_identity_federation}")
else:
    print("Workspace does not have Identity Federation enabled.")

# Output: Workspace Identity Federation: True

How is this tested?

  • I have based the code on the Website API response (Browser -> Networking-tab) in Account console.
  • I've created a notebook to manually fetch a enabled and disabled IdentityFederated workspace. (code is attached)

ALWAYS ANSWER THIS QUESTION: Answer with "N/A" if tests are not applicable to your PR (e.g. if the PR only modifies comments). Do not be afraid of answering "Not tested" if the PR has not been tested. Being clear about what has been done and not done provides important context to the reviewers.

abij avatar Dec 06 '24 21:12 abij

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger: go/deco-tests-run/sdk-py

Inputs:

  • PR number: 835
  • Commit SHA: ecb9f01ee9c6e48666597c371f6722e80ccec74f

Checks will be approved automatically on success.

github-actions[bot] avatar Jan 22 '25 13:01 github-actions[bot]