Skip to content

Problem with Microsoft Azure Provider base_azure hook #33025

@shakeelansari63

Description

@shakeelansari63

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions