<?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: connect to Azure resources from a User Data Function in Data Engineering</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Engineering/connect-to-Azure-resources-from-a-User-Data-Function/m-p/4880774#M13596</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/840230"&gt;@mehr_sa&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Just looping back one last time to check if everything's good on your end. Let me know if you need any final support happy to assist if anything’s still open.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Nov 2025 09:20:35 GMT</pubDate>
    <dc:creator>v-sgandrathi</dc:creator>
    <dc:date>2025-11-20T09:20:35Z</dc:date>
    <item>
      <title>connect to Azure resources from a User Data Function</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/connect-to-Azure-resources-from-a-User-Data-Function/m-p/4873001#M13391</link>
      <description>&lt;P&gt;I have a standalone Python program that performs part of ETL, which anyone can run from their local computer. I need to integrate this program into the Fabric. I found that User Data Functions are suitable for such scenarios.&lt;BR /&gt;In the Python program, I connect to the Azure SQL database and Azure storage account using a Service Principal or a managed Identity.&lt;BR /&gt;How can I connect to the Azure SQL database and Azure storage account from a Fabric User Data Function?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Nov 2025 09:27:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/connect-to-Azure-resources-from-a-User-Data-Function/m-p/4873001#M13391</guid>
      <dc:creator>mehr_sa</dc:creator>
      <dc:date>2025-11-12T09:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: connect to Azure resources from a User Data Function</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/connect-to-Azure-resources-from-a-User-Data-Function/m-p/4873037#M13393</link>
      <description>&lt;P&gt;Hi&amp;nbsp; &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/840230"&gt;@mehr_sa&lt;/a&gt;&amp;nbsp;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Yes, you can connect to Azure resources like Azure SQL Database and Azure Storage from a &lt;STRONG&gt;Fabric User Data Function (UDF).&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Inside your UDF, you can use &lt;STRONG&gt;Managed Identity or &lt;STRONG&gt;Service Principal authentication, similar to what you do in your standalone Python script. Here’s the approach:&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Enable Managed Identity for the Fabric workspace (if available in your tenant).&lt;/STRONG&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Grant appropriate permissions to that identity — for example:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;EM&gt;db_datareader / db_datawriter roles on Azure SQL.&lt;/EM&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;EM&gt;Storage Blob Data Contributor role on the storage account.&lt;/EM&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;In your Python UDF, use libraries like azure-identity and azure-storage-blob or pyodbc with Azure AD authentication to connect.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Use &lt;STRONG&gt;DefaultAzureCredential() from azure.identity — it will automatically pick up the Managed Identity when running inside Fabric.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;This way, you don’t have to store any credentials in code, and authentication is handled securely by Azure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Example (conceptual):&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;from azure.identity import DefaultAzureCredential&lt;BR /&gt;from azure.storage.blob import BlobServiceClient&lt;/P&gt;&lt;P&gt;credential = DefaultAzureCredential()&lt;BR /&gt;blob_service_client = BlobServiceClient(account_url="https://&amp;lt;storage_account&amp;gt;.blob.core.windows.net", credential=credential)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;For Azure SQL:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import pyodbc&lt;BR /&gt;token = credential.get_token("&lt;A href="https://database.windows.net/.default" target="_blank" rel="noopener"&gt;https://database.windows.net/.default")&lt;BR /&gt;conn = pyodbc.connect("Driver={ODBC Driver 18 for SQL Server};Server=tcp:&amp;lt;server&amp;gt;.database.windows.net;Database=&amp;lt;db&amp;gt;;Encrypt=yes;TrustServerCertificate=no;", attrs_before={1256: token.token})&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That’s the recommended way to connect securely from a Fabric UDF.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;&lt;STRONG&gt;Gopi Krishna&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Nov 2025 10:11:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/connect-to-Azure-resources-from-a-User-Data-Function/m-p/4873037#M13393</guid>
      <dc:creator>Ugk161610</dc:creator>
      <dc:date>2025-11-12T10:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: connect to Azure resources from a User Data Function</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/connect-to-Azure-resources-from-a-User-Data-Function/m-p/4873877#M13412</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/840230"&gt;@mehr_sa&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/920086"&gt;@Ugk161610&lt;/a&gt;&amp;nbsp;for your answer and helpful explanation.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Alongside the previously mentioned points, there are some Fabric-specific considerations when connecting to Azure SQL and Azure Storage from a User Data Function. When your Python script runs inside a User Data Function, it operates within the Fabric runtime, not on your local machine. Therefore, connection details like server names, database names, or storage account names should be stored securely in Fabric, such as in the Workspace Variable Library, rather than on your computer. This approach prevents hard-coding values and simplifies management across different environments.&lt;/P&gt;
&lt;P&gt;Ensure the identity used by the function has the necessary permissions in Azure. If using a managed identity or service principal, it needs to be added to Azure SQL as an Entra user with the appropriate database roles, and the SQL server firewall or network settings must allow access from Fabric. For Azure Storage, the same identity should have a suitable data access role, like Storage Blob Data Contributor, and the storage networking should permit Fabric to access the account.&lt;/P&gt;
&lt;P&gt;Lastly, User Data Functions are intended for short and efficient tasks. If your ETL script is lengthy, consider dividing it into smaller segments or handling extensive processing in a Fabric pipeline or notebook, with the UDF managing only the necessary function call operations.&lt;BR /&gt;&lt;BR /&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Nov 2025 05:15:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/connect-to-Azure-resources-from-a-User-Data-Function/m-p/4873877#M13412</guid>
      <dc:creator>v-sgandrathi</dc:creator>
      <dc:date>2025-11-13T05:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: connect to Azure resources from a User Data Function</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/connect-to-Azure-resources-from-a-User-Data-Function/m-p/4876517#M13466</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/840230"&gt;@mehr_sa&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;Just wanted to follow up and confirm that everything has been going well on this. Please let me know if there’s anything from our end.&lt;BR /&gt;Please feel free to reach out Microsoft fabric community forum.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;Thank you.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Nov 2025 08:06:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/connect-to-Azure-resources-from-a-User-Data-Function/m-p/4876517#M13466</guid>
      <dc:creator>v-sgandrathi</dc:creator>
      <dc:date>2025-11-16T08:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: connect to Azure resources from a User Data Function</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/connect-to-Azure-resources-from-a-User-Data-Function/m-p/4880774#M13596</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/840230"&gt;@mehr_sa&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Just looping back one last time to check if everything's good on your end. Let me know if you need any final support happy to assist if anything’s still open.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Nov 2025 09:20:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/connect-to-Azure-resources-from-a-User-Data-Function/m-p/4880774#M13596</guid>
      <dc:creator>v-sgandrathi</dc:creator>
      <dc:date>2025-11-20T09:20:35Z</dc:date>
    </item>
  </channel>
</rss>

