Skip to content

Problem with Microsoft Azure Provider base_azure hook #33025

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

Closed
1 of 2 tasks
shakeelansari63 opened this issue Aug 2, 2023 · 11 comments
Closed
1 of 2 tasks

Problem with Microsoft Azure Provider base_azure hook #33025

shakeelansari63 opened this issue Aug 2, 2023 · 11 comments
Assignees
Labels
area:providers kind:bug This is a clearly a bug provider:microsoft-azure Azure-related issues

Comments

@shakeelansari63
Copy link

shakeelansari63 commented Aug 2, 2023

Apache Airflow version

2.6.3

What happened

When using AzureBaseHook from airflow/providers/microsoft/azure/hooks/base_azure.py with SDKClient class, the get_conn() method fails to instanciate the Client class object.

The error message says, missing parameter credential

This is because the sdk_client is being instanciated with credentials=ServicePrincipalCredentials

Notice an extra s in credentials key which is not needed.

What you think should happen instead

The sdk_client should be instanciated with credential=ServicePrincipalCredential which will be instanciated correctly

How to reproduce

  1. Install any Azure client, let's say azure-monitor-query
    pip install azure-monitor-query

  2. Use the Azure connection with Azure client

from airflow.providers.microsoft.azure.hooks.base_azure import AzureBaseHook
from azure.monitor.query import LogsQueryClient

# Lets say we have an azure connection with name Azure_Default

conn = AzureBaseHook(sdk_client = LogsQueryClient, conn_id = 'Azure_Default')
client = conn.get_conn()

This will fail -

Operating System

Any

Versions of Apache Airflow Providers

apache-airflo-providers-microsoft-azure v6.2.1

Deployment

Official Apache Airflow Helm Chart

Deployment details

No response

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@shakeelansari63 shakeelansari63 added area:core kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet labels Aug 2, 2023
@boring-cyborg
Copy link

boring-cyborg bot commented Aug 2, 2023

Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.

@nathadfield nathadfield added provider:microsoft-azure Azure-related issues and removed area:core labels Aug 2, 2023
@nathadfield nathadfield self-assigned this Aug 2, 2023
@nathadfield nathadfield added area:providers and removed needs-triage label for new issues that we didn't triage yet labels Aug 2, 2023
@nathadfield
Copy link
Collaborator

@shakeelansari63 This looks like a simple change but I have not been able to replicate this with the code you provided. Can you review this or do you have an example DAG that can illustrate the problem?

@nathadfield nathadfield added pending-response needs-triage label for new issues that we didn't triage yet labels Aug 2, 2023
@shakeelansari63
Copy link
Author

Hi @nathadfield ,

Here is example -
I have created an Azure Connection As Follow -
image

Note: I haven't added any key_json or key_path in extra. Which means, following piece of code will be ran to instanciate the client -
image

And When I call the get_conn() method, it gives following error -
image

And this error is because it need credentail not credentials.

@nathadfield nathadfield removed pending-response needs-triage label for new issues that we didn't triage yet labels Aug 2, 2023
@nathadfield
Copy link
Collaborator

nathadfield commented Aug 3, 2023

@shakeelansari63 Having made this change, we are now encountering test failures and so I remain unconvinced that this is indeed a problem.

        self.log.info("Getting connection using specific credentials and subscription_id.")
>       return self.sdk_client(
            credential=ServicePrincipalCredentials(client_id=conn.login, secret=conn.password, tenant=tenant),
            subscription_id=subscription_id,
        )
E       TypeError: __init__() got an unexpected keyword argument 'credential'

@nathadfield
Copy link
Collaborator

Changing this seems to break AzureContainerInstanceHook.

@pankajkoti
Copy link
Member

pankajkoti commented Aug 3, 2023

I added a comment on the PR guessing that could be the cause for failing tests #33040 (comment)

@shakeelansari63
Copy link
Author

shakeelansari63 commented Aug 3, 2023

@nathadfield , I got the issue here.
Looks like you are using very old version of azure SDK.

I looked into one of the failure, for ContainerInstanceManagementClient.

This is from provider.yaml

 - azure-mgmt-containerinstance>=1.5.0,<2.0

This is very old version of azure SDK (from 2019) which is still using credentials parameter. But in newer version all azure sdks use credential parameter.

@shakeelansari63
Copy link
Author

From what I can see from Pypi, latest version of azure-mgmt-containerinstance is 10.1.0

@nathadfield
Copy link
Collaborator

@shakeelansari63 Yep. I'll ask around to see what I can find out but it seems like you won't be able to use LogsQueryClient until azure-mgmt-containerinstance is brought up to date.

@nathadfield
Copy link
Collaborator

#30199

@eladkal
Copy link
Contributor

eladkal commented Aug 3, 2023

I'm closing this issue as the root cause is updating old package as listed in #30199

PRs are welcome.
Azure offers Airflow as managed service in their eco system try maybe contacting Azure support maybe they will assign an engineer to work on Azure open source issues.

@eladkal eladkal closed this as completed Aug 3, 2023
pankajkoti added a commit to astronomer/airflow that referenced this issue Aug 3, 2023
While working on issue apache#33025, it was unclear on why we've pinned
dependencies for Azure integration. And it was pointed out that
we have an open issue for this. Link the same along with the TODO
in the provider.yaml so that if someone takes a look later, they
will know that we have an issue for it and the issue has relevant
description.
potiuk pushed a commit that referenced this issue Aug 3, 2023
…3064)

While working on issue #33025, it was unclear on why we've pinned
dependencies for Azure integration. And it was pointed out that
we have an open issue for this. Link the same along with the TODO
in the provider.yaml so that if someone takes a look later, they
will know that we have an issue for it and the issue has relevant
description.
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this issue Jul 18, 2024
…3064)

While working on issue apache/airflow#33025, it was unclear on why we've pinned
dependencies for Azure integration. And it was pointed out that
we have an open issue for this. Link the same along with the TODO
in the provider.yaml so that if someone takes a look later, they
will know that we have an issue for it and the issue has relevant
description.

GitOrigin-RevId: a069965df84273c65e23d1fda9ffa47a58ed6732
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this issue Sep 19, 2024
…3064)

While working on issue apache/airflow#33025, it was unclear on why we've pinned
dependencies for Azure integration. And it was pointed out that
we have an open issue for this. Link the same along with the TODO
in the provider.yaml so that if someone takes a look later, they
will know that we have an issue for it and the issue has relevant
description.

GitOrigin-RevId: a069965df84273c65e23d1fda9ffa47a58ed6732
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this issue Nov 8, 2024
…3064)

While working on issue apache/airflow#33025, it was unclear on why we've pinned
dependencies for Azure integration. And it was pointed out that
we have an open issue for this. Link the same along with the TODO
in the provider.yaml so that if someone takes a look later, they
will know that we have an issue for it and the issue has relevant
description.

GitOrigin-RevId: a069965df84273c65e23d1fda9ffa47a58ed6732
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this issue May 4, 2025
…3064)

While working on issue apache/airflow#33025, it was unclear on why we've pinned
dependencies for Azure integration. And it was pointed out that
we have an open issue for this. Link the same along with the TODO
in the provider.yaml so that if someone takes a look later, they
will know that we have an issue for it and the issue has relevant
description.

GitOrigin-RevId: a069965df84273c65e23d1fda9ffa47a58ed6732
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this issue May 25, 2025
…3064)

While working on issue apache/airflow#33025, it was unclear on why we've pinned
dependencies for Azure integration. And it was pointed out that
we have an open issue for this. Link the same along with the TODO
in the provider.yaml so that if someone takes a look later, they
will know that we have an issue for it and the issue has relevant
description.

GitOrigin-RevId: a069965df84273c65e23d1fda9ffa47a58ed6732
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers kind:bug This is a clearly a bug provider:microsoft-azure Azure-related issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants