Sign inGet started

Microsoft Azure Blob Storage

Available to teams and users on all plans

Deepnote can fetch blobs from Azure Blob Storage. Follow these docs to create your own notebook to connect to your storage container.

1. Duplicate the Azure Blob Storage template

Open the template by following this link ->

spaces%2FtfH69m1V6bYYvquUay8O%2Fuploads%2FuBTyirnZvPcOcczBxtFa%2Fduplicate-notebook.png

Click the "duplicate" button on the top right corner to do this. Once you've got the template in your Deepnote workspace, you can connect it to your Synapse workspace.

2. Connect to Azure Blob Storage from Deepnote

Get the connection string for connecting to your container

To fetch blobs from an Azure storage container, you need a connection string for the container's storage account. Find your connection string by following these instructions.

Update the connection string in your notebook

Change the variable AZURE_BLOG_STORAGE_CONNECTION_STRING to match the connection string. If you'd like to keep your data secure, consider storing the token as an environment variable. Environment variables in Deepnote are encrypted and provide a secure way of storing sensitive data.

Update the container name in your notebook

Set AZURE_BLOB_STORAGE_CONTAINER_NAME to the name of the container you want to fetch blobs from.

3. Fetch Azure blobs from Deepnote

The notebook will set up a container_client that you can use to fetch any of the blobs in a container. For example, to get a list of all the blobs.

# Fetch all the blobs and their names
blobs = [*container_client.list_blobs()]
blob_names = [blob.name for blob in blobs]
blob_names

When executing the code above, Deepnote will show the blob_names result as a list.

You can also fetch individual blobs. In our example, our blobs are images (of Mars!), so we generate a thumbnail.

blob_download_stream = container_client.download_blob(blob_names[5])

image = Image.open(io.BytesIO(blob_download_stream.readall()))

image_thumbnail = image.copy()
image_thumbnail.thumbnail([500, 500])
image_thumbnail.show()

When executing this, Deepnote will fetch the blob and display the thumbnail.

What's next?

Now that you're fetching blobs, you can share it with your team. You can even turn your charts into a shareable dashboard.

For more information on how to use the Azure SDK, you can read their docs.