ERROR | Azure Key Vault access from Python application in Azure Kubernetes Service

AT 0 Reputation points
2024-09-30T21:17:29.92+00:00

I have a python application in AKS where I need to read the secrets from Azure key vault.

I am using:

credential = DefaultAzureCredential(logging_enable=True)
client = SecretClient(vault_url=KV_URI, credential=credential)
secret = client.get_secret(secretName)

I have the managed identity which has read access RBAC on the vault but I am getting Timeout errors.

along with these messages:

[ERROR] - Unable to connect to KV using DefaultAzureCredential, ERROR: (<urllib3.connection.HTTPSConnection object at 0x7f2dc85c2c90>, 'Connection to <vault_name>.vault.azure.net timed out. (connect timeout=300)')

[App: azure.identity._credentials.environment -- Module: environment --Line# 109] [INFO] - Incomplete environment configuration for EnvironmentCredential. These variables are set: AZURE_CLIENT_ID, AZURE_TENANT_ID

[App: azure.identity._credentials.managed_identity -- Module: managed_identity --Line# 80] [INFO] - ManagedIdentityCredential will use workload identity

[INFO] - credential Object: <azure.identity._credentials.default.DefaultAzureCredential object at 0x7f2e00442150>

[INFO] - Request URL: 'https://<vault_name>.vault.azure.net/secrets/snowflake-password/?api-version=REDACTED'

Request method: 'GET'

Request headers:

'Accept': 'application/json'

'x-ms-client-request-id': '517c4ebb-7f70-11ef-b4ad-d9ce3dacc7ab'

'User-Agent': 'azsdk-python-keyvault-secrets/4.8.0 Python/3.12.3 (Linux-5.15.0-1071-azure-x86_64-with-glibc2.39)'

No body was attached to the request

What should I check ?

Azure Key Vault
Azure Key Vault
An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
1,293 questions
Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,127 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.