<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to bind a User assigned Managed identity to Databricks to access external resources? in Administration &amp; Architecture</title>
    <link>https://community.databricks.com/t5/administration-architecture/how-to-bind-a-user-assigned-managed-identity-to-databricks-to/m-p/65296#M1040</link>
    <description>&lt;P&gt;Is there a way to bind a user assigned managed identity to Databricks? We want to access some SQL DBs, Redis cache from our Spark code running on Databricks using Managed Identity instead of Service Principals and basic authentication.&lt;/P&gt;&lt;P&gt;As of today, Databricks provides Managed identity access for incoming traffic (i.e., to connect to Databricks from external resources) and not for outgoing traffic. Only thing that works for outgoing is accessing Unity catalog using the connector, but we are looking for resources beyond storage.&lt;/P&gt;&lt;P&gt;e.g., Other resources on Azure support System assigned managed identity and User assigned managed identity under "Identity" tab of the resource. Same is not available for Databricks. We are looking for a workaround or fix for this issue.&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Note&lt;/STRONG&gt;&lt;/U&gt;: Databricks assigned Managed identity present in the Managed Resource group (MRG) is not a scalable solution for us&lt;/P&gt;</description>
    <pubDate>Tue, 02 Apr 2024 11:20:57 GMT</pubDate>
    <dc:creator>sushant047_ms</dc:creator>
    <dc:date>2024-04-02T11:20:57Z</dc:date>
    <item>
      <title>How to bind a User assigned Managed identity to Databricks to access external resources?</title>
      <link>https://community.databricks.com/t5/administration-architecture/how-to-bind-a-user-assigned-managed-identity-to-databricks-to/m-p/65296#M1040</link>
      <description>&lt;P&gt;Is there a way to bind a user assigned managed identity to Databricks? We want to access some SQL DBs, Redis cache from our Spark code running on Databricks using Managed Identity instead of Service Principals and basic authentication.&lt;/P&gt;&lt;P&gt;As of today, Databricks provides Managed identity access for incoming traffic (i.e., to connect to Databricks from external resources) and not for outgoing traffic. Only thing that works for outgoing is accessing Unity catalog using the connector, but we are looking for resources beyond storage.&lt;/P&gt;&lt;P&gt;e.g., Other resources on Azure support System assigned managed identity and User assigned managed identity under "Identity" tab of the resource. Same is not available for Databricks. We are looking for a workaround or fix for this issue.&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Note&lt;/STRONG&gt;&lt;/U&gt;: Databricks assigned Managed identity present in the Managed Resource group (MRG) is not a scalable solution for us&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2024 11:20:57 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/how-to-bind-a-user-assigned-managed-identity-to-databricks-to/m-p/65296#M1040</guid>
      <dc:creator>sushant047_ms</dc:creator>
      <dc:date>2024-04-02T11:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to bind a User assigned Managed identity to Databricks to access external resources?</title>
      <link>https://community.databricks.com/t5/administration-architecture/how-to-bind-a-user-assigned-managed-identity-to-databricks-to/m-p/65349#M1041</link>
      <description>&lt;P&gt;I just went through this issue. You can use a user managed identity but you have to pass an access token. You have to enable and add the identity to sql and assign it a role. There is some more in depth documentation above you can find. Then the below code is used. I got this from a resource and not my own code.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;%pip install azure-identity&lt;/P&gt;&lt;P&gt;from azure.identity import DefaultAzureCredential, ManagedIdentityCredential&lt;BR /&gt;credential = ManagedIdentityCredential(clientId = "&amp;lt;your clientid&amp;gt;")&lt;BR /&gt;sqlAzureAccessToken = credential.get_token('&lt;A href="https://database.windows.net/.default').token" target="_blank"&gt;https://database.windows.net/.default').token&lt;/A&gt;&lt;BR /&gt;print(credential.get_token('&lt;A href="https://database.windows.net/.default" target="_blank"&gt;https://database.windows.net/.default&lt;/A&gt;'))&lt;/P&gt;&lt;P&gt;jdbcHostname = "&amp;lt;servername&amp;gt;.database.windows.net"&lt;BR /&gt;jdbcDatabase = "&amp;lt;dbname&amp;gt;"&lt;BR /&gt;jdbcPort = 1433&lt;BR /&gt;jdbcUrl = "jdbc:sqlserver://{0}:{1};database={2}".format(jdbcHostname, jdbcPort, jdbcDatabase)&lt;BR /&gt;connectionProperties = {&lt;BR /&gt;"accessToken" : sqlAzureAccessToken,&lt;BR /&gt;"hostNameInCertificate" : "*.database.windows.net",&lt;BR /&gt;"encrypt" : "true",&lt;BR /&gt;"ServerCertificate" : "false",&lt;BR /&gt;"driver" : "com.microsoft.sqlserver.jdbc.SQLServerDriver"&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;df = spark.read.jdbc(url=jdbcUrl, table="dbo.person", properties=connectionProperties)&lt;BR /&gt;display(df)&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2024 00:44:18 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/how-to-bind-a-user-assigned-managed-identity-to-databricks-to/m-p/65349#M1041</guid>
      <dc:creator>Carpender</dc:creator>
      <dc:date>2024-04-03T00:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to bind a User assigned Managed identity to Databricks to access external resources?</title>
      <link>https://community.databricks.com/t5/administration-architecture/how-to-bind-a-user-assigned-managed-identity-to-databricks-to/m-p/65398#M1043</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/103156"&gt;@Carpender&lt;/a&gt;&amp;nbsp;I have tried it with both Databricks assigned identity in the MRG (using DefaultAzureCredential class) and User Assigned Managed Identity (using ManagedIdentityCredential class) and both of them resulted in an exception when I tried reading with the generated token (&lt;SPAN&gt;SQLServerException: Login failed for user '&amp;lt;token-identified principal&amp;gt;')&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2024 11:39:42 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/how-to-bind-a-user-assigned-managed-identity-to-databricks-to/m-p/65398#M1043</guid>
      <dc:creator>sushant047_ms</dc:creator>
      <dc:date>2024-04-03T11:39:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to bind a User assigned Managed identity to Databricks to access external resources?</title>
      <link>https://community.databricks.com/t5/administration-architecture/how-to-bind-a-user-assigned-managed-identity-to-databricks-to/m-p/65562#M1049</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/103156"&gt;@Carpender&lt;/a&gt;&amp;nbsp;correcting my comment above, Databricks assigned Managed Identity is working and we are able to access but as stated in the original question we are looking for authorization using User Assigned Managed Identity (UAMI). With UAMI we cannot even create a token as the UAMI cannot be assigned/binded to Databricks like other Azure 1P resources. It throws exception as below&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Caused by: MsalAzureSDKException: java.util.concurrent.ExecutionException: com.azure.identity.CredentialUnavailableException: ManagedIdentityCredential authentication unavailable. Connection to IMDS endpoint cannot be established.&lt;BR /&gt;Caused by: ExecutionException: com.azure.identity.CredentialUnavailableException: ManagedIdentityCredential authentication unavailable. Connection to IMDS endpoint cannot be established. &lt;BR /&gt;Caused by: CredentialUnavailableException: ManagedIdentityCredential authentication unavailable. Connection to IMDS endpoint cannot be established.&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Apr 2024 08:53:53 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/how-to-bind-a-user-assigned-managed-identity-to-databricks-to/m-p/65562#M1049</guid>
      <dc:creator>sushant047_ms</dc:creator>
      <dc:date>2024-04-05T08:53:53Z</dc:date>
    </item>
  </channel>
</rss>

