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

Fix Azure filesystem hierarchical namespaces check #20897

Merged
merged 6 commits into from
Mar 5, 2024

Conversation

charlesjmorgan
Copy link
Member

Description

The hierarchical namespaces check in the native Azure filesystem is not compatible with authentication via OAuth tokens. The existing check uses the "Get Account Information" blob service account REST API endpoint. As stated in the documentation for this endpoint, it does not support OAuth based access token authentication:

https://learn.microsoft.com/en-us/rest/api/storageservices/get-account-information?tabs=shared-access-signatures#authorization

In order to fix the Azure filesystem OAuth integration we have figured out an alternate method of checking if hierarchical namespaces are enabled for an account using other apis made available in the azure-sdk-for-java. The method used in this PR checks if the root directory exists on the account. If it exists, then HNS is enabled for the account, if it does not exist then HNS is not enabled for the account.

An issue has been opened in the azure-sdk-for-java repo in order to get feedback on this approach and to see if they are planning to add support for OAuth token based authentication to the "Get Account Information" API. Azure/azure-sdk-for-java#38912

Additionally, as part of these changes I have refactored some of the testing infrastructure for the Azure filesystem in order to support tests using OAuth. All that needs to be done is to add the env variables/secrets to CI. #18998

Additional context and related issues

Release notes

(X) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text:

# Section
* Fix some things. ({issue}`issuenumber`)

@findinpath
Copy link
Contributor

Tested locally successfully

findinpath and others added 6 commits March 4, 2024 14:03
This dependency is needed in Azure scenarios which require OAuth2.
Co-authored-by: Charles Morgan <charles.morgan@starburstdata.com>
The method previously used to check if hierarchical namespaces are
enabled for an Azure storage account was not available when doing
authentication with service tokens (in OAuth2.0 scenarios).
This change uses a generic strategy to check whether a storage
account has HNS enabled independently of the authentication method.

Co-authored-by: Marius Grama <findinpath@gmail.com>
Co-authored-by: Marius Grama <findinpath@gmail.com>
@charlesjmorgan charlesjmorgan force-pushed the cm/fix-azure-hns-check branch from cdafe84 to ba9181e Compare March 4, 2024 22:53
@dain dain merged commit 94529b9 into trinodb:master Mar 5, 2024
96 checks passed
@github-actions github-actions bot added this to the 440 milestone Mar 5, 2024
@charlesjmorgan charlesjmorgan deleted the cm/fix-azure-hns-check branch March 5, 2024 05:02
@charlesjmorgan
Copy link
Member Author

FYI I created https://feedback.azure.com/d365community/idea/bd29191f-ebdb-ee11-a73d-0022484c4e0d in order to request that they add OAuth based access token support to the Get account information endpoint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants