<?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 Re: Access Azure storage with serverless compute in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/access-azure-storage-with-serverless-compute/m-p/123749#M47062</link>
    <description>&lt;P&gt;Use the below code in your notebook. You cannot set spark config in serverless as there is no advanced options in cluster.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;credential_id = dbutils.secrets.get(scope="{scope_name}",key="{app_id}")
credential_key = dbutils.secrets.get(scope="{scope_name}",key="{app_key}")

spark.conf.set("fs.azure.account.auth.type.dfs.core.windows.net", "OAuth")
spark.conf.set("fs.azure.account.oauth.provider.type.dfs.core.windows.net", "org.apache.hadoop.fs.azurebfs.oauth2.ClientCredsTokenProvider")
spark.conf.set("fs.azure.account.oauth2.client.id.dfs.core.windows.net", credential_id)
spark.conf.set("fs.azure.account.oauth2.client.secret.dfs.core.windows.net", credential_key)
spark.conf.set("fs.azure.account.oauth2.client.endpoint.dfs.core.windows.net", "https://login.microsoftonline.com/{azure tenant id}/oauth2/token")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;If you are using serverless please use external locations and Unity catalog for data lake access.&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-external-locations" target="_blank" rel="noopener"&gt;https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-external-locations&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 02 Jul 2025 17:33:03 GMT</pubDate>
    <dc:creator>nayan_wylde</dc:creator>
    <dc:date>2025-07-02T17:33:03Z</dc:date>
    <item>
      <title>Access Azure storage with serverless compute</title>
      <link>https://community.databricks.com/t5/data-engineering/access-azure-storage-with-serverless-compute/m-p/123654#M47047</link>
      <description>&lt;P&gt;I would like to know how to connect to Azure Blob Storage in a Python job inside a workflow with serverless cluster. When working with a non-serverless cluster or with serverless in a declarative pipeline, I would typically set the Azure storage account key using the&amp;nbsp;spark.conf.set&amp;nbsp;method as shown below:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;spark.conf.set(
"fs.azure.account.key.&amp;lt;storage-account&amp;gt;.dfs.core.windows.net",
dbutils.secrets.get(scope="&amp;lt;scope&amp;gt;", key="&amp;lt;storage-account-access-key&amp;gt;"))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jul 2025 11:41:56 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/access-azure-storage-with-serverless-compute/m-p/123654#M47047</guid>
      <dc:creator>lucami</dc:creator>
      <dc:date>2025-07-02T11:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: Access Azure storage with serverless compute</title>
      <link>https://community.databricks.com/t5/data-engineering/access-azure-storage-with-serverless-compute/m-p/123703#M47059</link>
      <description>&lt;H3&gt;&lt;STRONG&gt;Option 1: Use Azure Service Principal + ABFS OAuth Authentication (Recommended for Prod)&lt;/STRONG&gt;&lt;/H3&gt;&lt;H4&gt;1. &lt;STRONG&gt;Register a Service Principal in Azure&lt;/STRONG&gt;&lt;/H4&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;Grant it access to the &lt;STRONG&gt;Blob Storage (container or storage account)&lt;/STRONG&gt; with &lt;STRONG&gt;Storage Blob Data Reader/Writer&lt;/STRONG&gt; roles.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;H4&gt;2. &lt;STRONG&gt;Mount using OAuth credentials&lt;/STRONG&gt;&lt;/H4&gt;&lt;PRE&gt;configs = {&lt;BR /&gt;"fs.azure.account.auth.type": "OAuth",&lt;BR /&gt;"fs.azure.account.oauth.provider.type": "org.apache.hadoop.fs.azurebfs.oauth2.ClientCredsTokenProvider",&lt;BR /&gt;"fs.azure.account.oauth2.client.id": dbutils.secrets.get(scope="&amp;lt;scope&amp;gt;", key="&amp;lt;client-id-key&amp;gt;"),&lt;BR /&gt;"fs.azure.account.oauth2.client.secret": dbutils.secrets.get(scope="&amp;lt;scope&amp;gt;", key="&amp;lt;client-secret-key&amp;gt;"),&lt;BR /&gt;"fs.azure.account.oauth2.client.endpoint": "https://login.microsoftonline.com/&amp;lt;tenant-id&amp;gt;/oauth2/token",&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;dbutils.fs.mount(&lt;BR /&gt;source = "abfss://&amp;lt;container&amp;gt;@&amp;lt;storage-account&amp;gt;.dfs.core.windows.net/",&lt;BR /&gt;mount_point = "/mnt/&amp;lt;mount-name&amp;gt;",&lt;BR /&gt;extra_configs = configs)&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;Note:- This works &lt;/SPAN&gt;&lt;STRONG&gt;in serverless clusters&lt;/STRONG&gt;&lt;SPAN&gt; and avoids using account keys (which are less secure).&lt;/SPAN&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Supported in Serverless&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;&lt;STRONG&gt;OAuth (Service Principal) -  Yes(Recommended)&lt;BR /&gt;dbutils.secrets -  Yes&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not Supported in Serverless&lt;/P&gt;&lt;PRE&gt;spark.conf.set&lt;SPAN&gt; for sensitive keys - &lt;STRONG&gt;NO&lt;BR /&gt;Environment variables - NO&lt;/STRONG&gt;&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H2&gt;Best Practice&lt;/H2&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;Use &lt;STRONG&gt;Azure AD OAuth (Service Principal)&lt;/STRONG&gt; wherever possible.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Store secrets in &lt;STRONG&gt;Databricks Secrets&lt;/STRONG&gt; and access them securely.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Wed, 02 Jul 2025 14:57:28 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/access-azure-storage-with-serverless-compute/m-p/123703#M47059</guid>
      <dc:creator>CURIOUS_DE</dc:creator>
      <dc:date>2025-07-02T14:57:28Z</dc:date>
    </item>
    <item>
      <title>Re: Access Azure storage with serverless compute</title>
      <link>https://community.databricks.com/t5/data-engineering/access-azure-storage-with-serverless-compute/m-p/123749#M47062</link>
      <description>&lt;P&gt;Use the below code in your notebook. You cannot set spark config in serverless as there is no advanced options in cluster.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;credential_id = dbutils.secrets.get(scope="{scope_name}",key="{app_id}")
credential_key = dbutils.secrets.get(scope="{scope_name}",key="{app_key}")

spark.conf.set("fs.azure.account.auth.type.dfs.core.windows.net", "OAuth")
spark.conf.set("fs.azure.account.oauth.provider.type.dfs.core.windows.net", "org.apache.hadoop.fs.azurebfs.oauth2.ClientCredsTokenProvider")
spark.conf.set("fs.azure.account.oauth2.client.id.dfs.core.windows.net", credential_id)
spark.conf.set("fs.azure.account.oauth2.client.secret.dfs.core.windows.net", credential_key)
spark.conf.set("fs.azure.account.oauth2.client.endpoint.dfs.core.windows.net", "https://login.microsoftonline.com/{azure tenant id}/oauth2/token")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;If you are using serverless please use external locations and Unity catalog for data lake access.&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-external-locations" target="_blank" rel="noopener"&gt;https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-external-locations&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jul 2025 17:33:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/access-azure-storage-with-serverless-compute/m-p/123749#M47062</guid>
      <dc:creator>nayan_wylde</dc:creator>
      <dc:date>2025-07-02T17:33:03Z</dc:date>
    </item>
  </channel>
</rss>

