Connecting to Microsoft Fabric OneLake from Azure Machine Learning Notebooks

Mohamed AminMohamed Amin
1 min read

This article describes how to connect to Microsoft Fabric OneLake using Azure Machine Leaning Notebooks and Python.

  1. Create a compute instance

  2. From Notebooks create a new .py file or .ipynb. Use the following code: https://learn.microsoft.com/en-us/fabric/onelake/onelake-access-python#sample

  3. You can get "myWorkspace" and "myLakeHose" from the Lakehouse properties URL. The URL is formatted as follows: https://onelake.dfs.fabric.microsoft.com/myWorkspace/myLakehouse/Files

  1. To run the code in Notebooks, open a terminal and attach it to your compute.

  2. In the command line. install Azure storage and Azure identity packages:$pip install azure-storage-file-datalake azure-identity

  3. Navigate to the location of your Python file: For example: $cd ~/cloudfiles/code/Users/admin

  4. The code uses Default credentials of the logged in user from the command line. Login using using: $az login --identity

  5. Make sure the logged in user has access to the files in the Fabric Lakehouse

  6. Run the Python file to list the files in the OneLake/Files directory: $python ./onelake.py

  7. If it succeeds, you should see the files listed:

0
Subscribe to my newsletter

Read articles from Mohamed Amin directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Mohamed Amin
Mohamed Amin