Skip to content

Commit

Permalink
Databricks: fix verification of Managed Identity (#20550)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexott authored Dec 29, 2021
1 parent 8cf3d12 commit c5c18c5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion airflow/providers/databricks/hooks/databricks.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def _check_azure_metadata_service() -> None:
"""
try:
jsn = requests.get(
AZURE_METADATA_SERVICE_TOKEN_URL,
AZURE_METADATA_SERVICE_INSTANCE_URL,
params={"api-version": "2021-02-01"},
headers={"Metadata": "true"},
timeout=2,
Expand Down
4 changes: 2 additions & 2 deletions tests/providers/databricks/hooks/test_databricks.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from airflow.providers.databricks.hooks.databricks import (
AZURE_DEFAULT_AD_ENDPOINT,
AZURE_MANAGEMENT_ENDPOINT,
AZURE_METADATA_SERVICE_TOKEN_URL,
AZURE_METADATA_SERVICE_INSTANCE_URL,
AZURE_TOKEN_SERVICE_URL,
DEFAULT_DATABRICKS_SCOPE,
SUBMIT_RUN_ENDPOINT,
Expand Down Expand Up @@ -808,7 +808,7 @@ def test_submit_run(self, mock_requests):
run_id = self.hook.submit_run(data)

ad_call_args = mock_requests.method_calls[0]
assert ad_call_args[1][0] == AZURE_METADATA_SERVICE_TOKEN_URL
assert ad_call_args[1][0] == AZURE_METADATA_SERVICE_INSTANCE_URL
assert ad_call_args[2]['params']['api-version'] > '2018-02-01'
assert ad_call_args[2]['headers']['Metadata'] == 'true'

Expand Down

0 comments on commit c5c18c5

Please sign in to comment.