update AzureBaseHook to return credentials that supports get_token method#52182
Merged
potiuk merged 39 commits intoSep 29, 2025
Merged
Conversation
…b.com/karunpoudel/airflow into azurebasehook-creds-support-get_token
Contributor
Author
|
Hi, could someone look into this, please? |
Contributor
|
@potiuk , can this be assigned to anyone for review? |
Member
|
Please avoid pinging people directly - unless you know they are interested - and no, I am not assigning reviewers - and also here thi is work on voluntary bases and your PR might get picked by someone. If it is not and it is ready to be reviewed, you can just ping in general in your PR or in slack, but you should not expect that pinging random individuals is a good idea. And ideally - this generic pinging should happen after the Pr gets green and is related on top of latest main. Which i think has not happened yet for the PR? |
Member
|
errors to fix |
eladkal
reviewed
Aug 5, 2025
karunpoudel
marked this pull request as draft
August 10, 2025 14:02
karunpoudel
marked this pull request as ready for review
August 10, 2025 16:09
This was referenced Sep 16, 2025
dabla
pushed a commit
to dabla/airflow
that referenced
this pull request
Oct 12, 2025
…thod (apache#52182) * init * fx * fx * fx * doc update * Update azure.rst * fix * fix * fx * fix import * fix import * fix import * Update base_azure.py * precommit fixes * pre-commit and doc fix * refactor * included get_token method in hook for error handling * add test for get_token --------- Co-authored-by: Karun Poudel <karun.poudel@chrobinson.com> Co-authored-by: Karun Poudel <64540927+karunpoudel-chr@users.noreply.github.com>
69 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Databases like Snowflake and Azure Postgres Flex support connection using Azure OAUTH token. Newer Azure Identity credential objects like
ClientSecretCredentialandDefaultAzureCredentialsupportget_tokenmethod which can be used to generate OAUTH token. SnowflakeHook and PostgresHook can leverage AzureBaseHook to retrieve required token.In this PR:
get_credentialmethod and makesdk_clientargument optional so that the credential object can be retrieved without needing sdk_client. eg.AzureBaseHook().get_credential()use_azure_identity_objectin connection for backward compatibility. When set to true,get_credentialmethod will return newer credential object of typeClientSecretCredentialorDefaultAzureCredentialinstead of currentServicePrincipalCredentialsorAzureIdentityCredentialAdapter. Current credential object doesn't supportget_tokenmethod. eg.AzureBaseHook().get_credential().get_token()I am ok with not making
sdk_clientargument optional if there is any concern.Usage:
Create base azure connection using either client_secret or default azure credential.
Use above connection to retrieve token to connect to specific resource (e.g., azure postgres flex server).
PostgresHook could be updated to retrieve token using azure connection similar to how it currently uses aws connection.
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.