Skip to content

Move cloud-based to DefaultCredentials#1305

Open
hectorcast-db wants to merge 2 commits intomainfrom
hector/cloud-filtering-in-orchestrator
Open

Move cloud-based to DefaultCredentials#1305
hectorcast-db wants to merge 2 commits intomainfrom
hector/cloud-filtering-in-orchestrator

Conversation

@hectorcast-db
Copy link
Contributor

@hectorcast-db hectorcast-db commented Mar 3, 2026

Changes

Add orchestrator-level cloud filtering to DefaultCredentials via a _CLOUD_REQUIREMENTS map.

Background: A previous PR removed the individual is_azure()/is_gcp() guards from each credentials strategy (e.g. azure_cli, azure_service_principal, google_credentials, google_id) so that explicitly setting auth_type on a mismatched host would work correctly. However, that left no replacement filtering in auto-detect mode — meaning Azure strategies were being attempted on GCP hosts and vice-versa with no way to skip them early.

Solution: A _CLOUD_REQUIREMENTS dict maps auth type names to the cloud they require. DefaultCredentials.__call__ consults this map in auto-detect mode only:

  • In auto-detect mode (auth_type not set): strategies whose required cloud doesn't match the detected host cloud are skipped. Each skip is logged at debug level: Skipping "azure-cli": not configured for AZURE.
  • When auth_type is explicitly set: the map is not consulted and the named strategy is always attempted, regardless of detected host cloud (e.g. auth_type="azure-cli" on a GCP host).

Files changed:

  • databricks/sdk/credentials_provider.py — imports Cloud, adds _CLOUD_REQUIREMENTS map, adds cloud-filtering logic to DefaultCredentials.__call__
  • tests/test_credentials_provider.py — adds TestDefaultCredentialsCloudFiltering with two tests

Tests

  • test_skips_azure_strategy_on_gcp_host_in_auto_detect_mode — verifies an Azure strategy is skipped on a GCP host in auto-detect mode
  • test_bypasses_cloud_filter_when_auth_type_explicitly_set — verifies the Azure strategy is still attempted on a GCP host when auth_type is explicitly set

Python port of databricks/databricks-sdk-go#1505

🤖 Generated with Claude Code

… DefaultCredentials

In auto-detect mode, Azure strategies are skipped on GCP/AWS hosts and
GCP strategies are skipped on Azure/AWS hosts. When auth_type is
explicitly set, cloud filtering is bypassed so the named strategy is
always attempted regardless of host cloud.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link

github-actions bot commented Mar 3, 2026

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: 1305
  • Commit SHA: c15845eba102f73feca78d9c40a6dd6c273ba87e

Checks will be approved automatically on success.

@hectorcast-db hectorcast-db requested a review from tanmay-db March 3, 2026 17:18
@hectorcast-db hectorcast-db changed the title Move cloud-based credential filtering from individual strategies into DefaultCredentials Move cloud-based to DefaultCredentials Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants