Forum Discussion
How to read/write to Onelake lakehouse using function app
- Anonymous2 years ago
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-datalakeTo 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 TeamIf 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!
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!