I'm new to Azure and I would like to read a blob using pyspark but without using the account key. I used to read that blob using DefaultAzureCredential. I have tried generating a SAS Token and then running these 2 lines:
configuration = pyspark.SparkConf().set(
"fs.azure.sas."+ container_name + ".blob.core.windows.net",
sas)
spark = SparkSession \
.builder \
.config(conf = configuration) \
.appName("Read csv file") \
.getOrCreate()
df = spark.read.csv(location)
but I got this error :
org.apache.hadoop.fs.azure.AzureException: org.apache.hadoop.fs.azure.AzureException: No credentials found for account XXXXXXXXX in the configuration, and its container XXXXXXXX is not accessible using anonymous credentials. Please check if the container exists first. If it is not publicly available, you have to provide account credentials.
at org.apache.hadoop.fs.azure.AzureNativeFileSystemStore.createAzureStorageSession(AzureNativeFileSystemStore.java:1098)
To generate the sas I used the generate_blob_sas function.
Does it mean there's no way to read the data without the account key?