Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disabled managed identity on azureml compute instance #47

Merged
merged 1 commit into from
Feb 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion kedro_azureml/client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import logging
import os
from contextlib import contextmanager
from pathlib import Path
from tempfile import TemporaryDirectory
@@ -23,7 +24,13 @@ def _get_azureml_client(subscription_id: Optional[str], config: AzureMLConfig):
}

try:
credential = DefaultAzureCredential()
# On a AzureML compute instance, the managed identity will take precedence,
# while it does not have enough permissions.
# So, if we are on an AzureML compute instance, we disable the managed identity.
is_azureml_managed_identity = "MSI_ENDPOINT" in os.environ
credential = DefaultAzureCredential(
exclude_managed_identity_credential=is_azureml_managed_identity
)
# Check if given credential can get token successfully.
credential.get_token("https://management.azure.com/.default")
except Exception: