Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ def cf_dls_account_trusted_provider(cli_ctx, _):
def cf_dls_filesystem(cli_ctx, account_name):
from azure.datalake.store import core
from azure.cli.core._profile import Profile
from azure.cli.core.auth.util import resource_to_scopes

cred, _, _ = Profile(cli_ctx=cli_ctx).get_login_credentials()
return core.AzureDLFileSystem(
token_credential=cred,
store_name=account_name,
url_suffix=cli_ctx.cloud.suffixes.azure_datalake_store_file_system_endpoint)
url_suffix=cli_ctx.cloud.suffixes.azure_datalake_store_file_system_endpoint,
scopes=resource_to_scopes(cli_ctx.cloud.endpoints.active_directory_data_lake_resource_id)[0])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is weird that active_directory_data_lake_resource_id is only defined in AzureCloud:

active_directory_data_lake_resource_id='https://datalake.azure.net/',

Does this mean dls doesn't support sovereign clouds at all?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then should we use

scopes=resource_to_scopes(cli_ctx.cloud.endpoints.active_directory_data_lake_resource_id)[0] if cli_ctx.cloud.endpoints.active_directory_data_lake_resource_id else None

to avoid crush on sovereign clouds?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before #30770, resource=cli_ctx.cloud.endpoints.active_directory_data_lake_resource_id is passed to profile.get_login_credentials unconditionally.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The naming of scopes doesn't align with Track 2 mgmt SDKs where its equivalent is called credential_scopes.

Also, according to azure.datalake.store.lib.DatalakeRESTInterface.__init__

    def __init__(self, store_name=default_store, token_credential=None, scopes=None, url_suffix=default_adls_suffix, **kwargs):
        # in the case where an empty string is passed for the url suffix, it must be replaced with the default.
        url_suffix = url_suffix or default_adls_suffix
        self.local = threading.local()
        self.token_credential = token_credential
        self.scopes = scopes or "https://datalake.azure.net//.default"

the value of scopes is a str, unlike credential_scopes's value which is a list[str].