March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Solved! Go to Solution.
Thanks for your help, it was a mistake at my end. I was looking for a wrong file name.!
Thanks for your help, it was a mistake at my end. I was looking for a wrong file name.!
HI @sruthiramana,
I'm glad here you find the root causing and share it here.
Regards,
Xiaoxin Sheng
HI @sruthiramana,
The error message mention you can't directly access them without credentials, perhaps you can try to add authorization steps during load data from storage account.
For example:
from notebookutils import mssparkutils
# service principal
tenant_id = "<tenant_id>"
client_id = "<client_id>"
client_secret = mssparkutils.credentials.getSecret("https://YourKeyVault.vault.azure.net/","your-client-secret-secret-name")
# Azure storage detail
storage_account_name = "<account>"
container_name = "<container_name>"
file_path= "<file_path>"
# Spark configuration
spark.conf.set("fs.azure.account.auth.type", "OAuth")
spark.conf.set("fs.azure.account.oauth.provider.type", "org.apache.hadoop.fs.azurebfs.oauth2.ClientCredsTokenProvider")
spark.conf.set("fs.azure.account.oauth2.client.id", client_id)
spark.conf.set("fs.azure.account.oauth2.client.secret", client_secret)
spark.conf.set("fs.azure.account.oauth2.client.endpoint", f"https://login.microsoftonline.com/{tenant_id}/oauth2/token")
# Full file path
data_path = f"abfss://{container_name}@{storage_account_name}.dfs.core.windows.net/{file_path}"
# Read the data into a Spark DataFrame
df = spark.read.format("csv").option("header", "true").load(data_path)
# show the result
df.show()
Regards,
Xiaoxin Sheng
Hi @sruthiramana,
What is the abfss path you are using? You can replace the actual id-s with xxx, but I want to check if the right folders are selected. Furthermore, you don't need to start a Spark session within a Fabric notebook. Could you remove step 2? They may be a permission error there, since it is another session. A bit guessing here, but that session is not needed.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
8 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
13 | |
4 | |
3 | |
2 | |
2 |