cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Azure AAD token with Databricks for User defined managed Identity inside Docker Container

dsura
Contributor

Hi, We are currently using a Azure AAD Token inorder to authenticate with Databricks instead of generating Personal Access Tokens from Databricks. We have a multi-tenant architecture and so we are using Azure container instances to run multiple transformation pipelines parallel using dbT.

Inorder to authenticate with databricks we generate an AAD token inside the ACI using the user defined managed identity (UDMI) which has contributor and reader rights on databricks. We do get the AAD token back successfully. However, the token when passed to databricks returns a 403 error.

UDMI is also an admin in the databricks workspace.

[0m18:11:15.979533 [debug] [MainThread]: Opening a new connection, currently in state init
[0m18:11:18.694997 [debug] [MainThread]: Databricks adapter: failed to connect: Error during request to server: : User not authorized.
[0m18:11:18.694997 [debug] [MainThread]: Databricks adapter: <class 'databricks.sql.exc.RequestError'>: Error during request to server: : User not authorized.
[0m18:11:18.694997 [debug] [MainThread]: Databricks adapter: attempt: 1/30
[0m18:11:18.695990 [debug] [MainThread]: Databricks adapter: bounded-retry-delay: None
[0m18:11:18.695990 [debug] [MainThread]: Databricks adapter: elapsed-seconds: 2.699450731277466/900.0
[0m18:11:18.695990 [debug] [MainThread]: Databricks adapter: error-message: : User not authorized.
[0m18:11:18.695990 [debug] [MainThread]: Databricks adapter: http-code: 403

Is there anything that we are missing and have to add more to this? Any help on this is appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions

@Debayan Mukherjeeโ€‹ , We were able to fix the issue by changing the few guids that we used. Apparently the managed identity application id wasnt getting deployed appropriately by Terraform which caused this issue. It wasn't an issue related to Databricks Runtime.

View solution in original post

5 REPLIES 5

Debayan
Databricks Employee
Databricks Employee

Hi, This looks like an old issue which we have faced earlier, Could you please update the DBR to the latest version and try again?

Hi @Debayan Mukherjeeโ€‹ , We are using the below DBR. Can you let me know if this is good? Or I need to use 11.3? image.png

az login --identity --username /subscriptions/{subscription_ID}/resourcegroups/{resource_Group}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{user_defined_managed_Identity}
 
aad_token=$(az account get-access-token --resource 2ff814a6-3304-4ab8-85cb-cd0e6f879c1d --query "accessToken" --output tsv)

Debayan
Databricks Employee
Databricks Employee

Hi @Dharit Suraโ€‹ , Could you please try DBR 9.1 LTS , 11.2 and 11.3 LTS?

image@Debayan Mukherjeeโ€‹ , I am still getting the above error. I tried with 11.2, 11.3 LTS.

Can you let me know what permissions did you give to the UDMI in your poc? Or schedule a call to discuss about a possible solution?

@Debayan Mukherjeeโ€‹ , We were able to fix the issue by changing the few guids that we used. Apparently the managed identity application id wasnt getting deployed appropriately by Terraform which caused this issue. It wasn't an issue related to Databricks Runtime.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group