-
Notifications
You must be signed in to change notification settings - Fork 16.3k
update AzureBaseHook to return credentials that supports get_token method #52182
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
update AzureBaseHook to return credentials that supports get_token method #52182
Conversation
…b.com/karunpoudel/airflow into azurebasehook-creds-support-get_token
|
Hi, could someone look into this, please? |
|
@potiuk , can this be assigned to anyone for review? |
|
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? |
…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>
…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>
…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>
…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>
…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>
…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>
…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>
…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>
…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>
…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>
…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>
…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>
…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>
…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>
…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>
…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>
…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>
…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>
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.