Skip to content

Commit

Permalink
Merge pull request #47 from j0rd1smit/fix/compute_instance
Browse files Browse the repository at this point in the history
disabled managed identity on azureml compute instance
  • Loading branch information
marrrcin authored Feb 17, 2023
2 parents a4536af + 7e1ac39 commit c70cb18
Showing 1 changed file with 8 additions and 1 deletion.
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
Expand All @@ -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:
Expand Down

0 comments on commit c70cb18

Please sign in to comment.