Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
AdarshPanasri
Helper I
Helper I

How to read/write to Onelake lakehouse using function app

Hello Everyone, I want to read files from Onelake lakehouse in my function app or local setup, can someone help me connect to the lakehouse and get the files, also I would want to write some data back to the lakehouse.

 

I know we can refer to the storage similar to the ADLS gen2, but how do I authenticate my client to get the files from the Lakehouse, what permissions are needed to do so ?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @AdarshPanasri ,

 

To connect to OneLake Lakehouse and perform read/write operations, you can follow the steps below:

 

You can use Microsoft Entra ID to authenticate your client.

 

Here is a Python example:

 

First, run the following statement to install the required packages.

pip install azure-identity azure-storage-file-datalake

 

To authenticate, replace <your-tenant-id>, <your-client-id>, and <your-client-secret> with your actual tenant ID, client ID, and client secret, respectively.

from azure.identity import ClientSecretCredential
from azure.storage.filedatalake import DataLakeServiceClient

tenant_id = "<your-tenant-id>"
client_id = "<your-client-id>"
client_secret = "<your-client-secret>"

credential = ClientSecretCredential(tenant_id, client_id, client_secret)
service_client = DataLakeServiceClient(account_url=https://<your-account-name>.dfs.core.windows.net, credential=credential)

 

Regarding identity verification, this article may be helpful to you:

How to use service principal authentication to access Microsoft Fabric's OneLake (dataroots.io)

 

Regarding your question about permissions, there are two aspects.

 

Read permissions:

  • ReadData permissions on SQL endpoints to access data without SQL policies.
  • ReadAll permissions for all data in the lake warehouse using Apache Spark.

 

Write permissions:

  • You need to be assigned one of the following roles in your workspace: Admin, Member, or Contributor.

If you have any questions or need further help, feel free to contact me!

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @AdarshPanasri ,

 

To connect to OneLake Lakehouse and perform read/write operations, you can follow the steps below:

 

You can use Microsoft Entra ID to authenticate your client.

 

Here is a Python example:

 

First, run the following statement to install the required packages.

pip install azure-identity azure-storage-file-datalake

 

To authenticate, replace <your-tenant-id>, <your-client-id>, and <your-client-secret> with your actual tenant ID, client ID, and client secret, respectively.

from azure.identity import ClientSecretCredential
from azure.storage.filedatalake import DataLakeServiceClient

tenant_id = "<your-tenant-id>"
client_id = "<your-client-id>"
client_secret = "<your-client-secret>"

credential = ClientSecretCredential(tenant_id, client_id, client_secret)
service_client = DataLakeServiceClient(account_url=https://<your-account-name>.dfs.core.windows.net, credential=credential)

 

Regarding identity verification, this article may be helpful to you:

How to use service principal authentication to access Microsoft Fabric's OneLake (dataroots.io)

 

Regarding your question about permissions, there are two aspects.

 

Read permissions:

  • ReadData permissions on SQL endpoints to access data without SQL policies.
  • ReadAll permissions for all data in the lake warehouse using Apache Spark.

 

Write permissions:

  • You need to be assigned one of the following roles in your workspace: Admin, Member, or Contributor.

If you have any questions or need further help, feel free to contact me!

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

Helpful resources

Announcements
August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.