Blog Post

Azure Database Support Blog
2 MIN READ

Lesson Learned #384: ODBC driver not supporting AKS workload identity

Jose_Manuel_Jurado's avatar
Jun 27, 2023

We have detected customers attempting to use Workload Identity with the ODBC Driver. Unfortunately, it is currently not supported, and I would like to share workarounds and lessons learned.

 

Azure AD workload identity with Azure Kubernetes Service (AKS) is a feature that enables seamless integration between AKS clusters and Azure Active Directory (Azure AD). It provides a way to authenticate and authorize individual pods or services within an AKS cluster using Azure AD identities.

 

Here's an overview of how Azure AD workload identity works with AKS:

 

1. Managed Identity: Azure AD workload identity leverages Azure Managed Identity, which is a service that provides an identity for Azure resources. When enabled for AKS, each pod or service within the cluster gets its own managed identity.

2. Azure AD Integration: AKS integrates with Azure AD, which is a cloud-based identity and access management service. This integration allows the AKS cluster to leverage Azure AD for authentication and authorization.

3. Assigning Azure AD Roles: With Azure AD workload identity, you can assign Azure AD roles to the managed identities associated with the pods or services in your AKS cluster. This allows fine-grained control over access to Azure resources.

4. Accessing Azure Resources: Once the managed identities are assigned Azure AD roles, the pods or services can access Azure resources directly using these identities. This eliminates the need to manage service principal credentials manually and improves security.

 

By utilizing Azure AD workload identity with AKS, you can achieve the following benefits:

 

- Improved Security: The use of managed identities ensures that credentials are not exposed in code or configuration files, enhancing the security of your AKS workloads.

- Simplified Credential Management: With managed identities, you don't need to manage service principal credentials explicitly. The identities are automatically provisioned and managed by Azure AD.

- Seamless Azure Integration: Azure AD workload identity enables seamless integration with Azure resources, allowing AKS workloads to access Azure services securely without the need for separate authentication mechanisms.

 

For more detailed information and guidance on implementing Azure AD workload identity with AKS, you can refer to the official Microsoft documentation at: [Azure AD Workload Identity with AKS]

 

You could have an alternative givin as AccessToken the token obtainined of Azure Workload Identity - Using Azure Active Directory with the ODBC Driver - ODBC Driver for SQL Server | Microsoft Learn 

 

Several error messages that you could face trying to use Azure Workload Identity 

 

  • SQLConnect() Failed, szSqlState = CE275, pfNativeError =0, pcbErrorMsg = 114, szErrorMsg = [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Error requesting access token, HTTP status 400, expected 200
  • szSqlState = FA004, pfNativeError =0, pcbErrorMsg = 245, szErrorMsg = [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Failed to authenticate the user 'XXXX' in Active Directory (Authentication option is 'ActiveDirectoryMSI').

 

Updated Jun 27, 2023
Version 3.0
No CommentsBe the first to comment