cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
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

7 REPLIES 7

Debayan
Esteemed Contributor III
Esteemed Contributor III

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
Esteemed Contributor III
Esteemed Contributor III

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.

Kaniz
Community Manager
Community Manager

Hi @Dharit Sura​, Thank you for the response. Would you select your answer as the best for the community?

Kaniz
Community Manager
Community Manager

Hi @Dharit Sura​ ​, We haven’t heard from you since the last response from @Debayan Mukherjee​ , and I was checking back to see if you have a resolution yet.

If you have any solution, please share it with the community as it can be helpful to others. Otherwise, we will respond with more details and try to help.

Also, Please don't forget to click on the "Select As Best" button whenever the information provided helps resolve your question.

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.