Azure Blob Storage is a service for storing large amounts of unstructured object data, such as text or binary data. You can use Blob Storage to expose data publicly to the world or to store application data privately.
In this post, I'll explain how to access Azure Blob Storage using spark framework on Python.
So, imagine that you already have an Azure storage account, you have data there.
Azure blob requires to install additional libraries for accessing data from it, because it uses wasb/wasbs protocol, not standard tcp/http/etc. The built jar files, named hadoop-azure.jar and azure-storage.jar need to be add to spark-submit when you submitting a job.
On the application level, first of all as always in spark applications, you need to grab a spark session:
Then you need to set up an account key:
OR SAS token for a container:
Once an account access key or a SAS is set up you're ready to read/write to Azure blob: