-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
{dls} Set scopes
when creating AzureDLFileSystem
#30786
Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
||
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]) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
|
||
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]) |
There was a problem hiding this comment.
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]
.
Related command
Description
The Track 2 migration for
azure-datalake-store
SDK (#30770) is incomplete - it doesn't setscopes
when creatingAzureDLFileSystem
.