Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
dungtran12
New Member

Help with Authentication failed and not presented in the request when reading a CSV file

Hello,

   I  tried the Micrososft Fabric tutorial on saving and reading the CSV file to and from the Lakehouse.

 

https://learn.microsoft.com/en-us/fabric/data-science/tutorial-data-science-ingest-data since I used the code from the notebook.

 

 

It worked fine on writting the csv file to the Lakehouse. However, it did not work when I tried to read the same csv file from the Lakehouse. The Notebook compiler complained on something like authentication failed and not presented on the request.

 

 

{"error":{"code":"Unauthorized","message":"Authentication Failed with Bearer token is not present in the request"}}

 

 

I was in my workspace and I had my CVS file presented in the Lakehouse. I did not know why it complaint about authentication on the request.  Could you please help to figure it out  what was missing since I used the exact same codes from the tutorial?

 

##df = (
##    spark.read.option("header", True)
##    .option("inferSchema", True)
##    .csv("/lakehouse/default/Files/churn/raw/churn.csv") 
##    .cache()   
##)


df = spark.read.format ("csv").option("header","true").load ("/lakehouse/default/Files/churn/raw/churn.csv")

 

 

I was in my workspace and I had my CVS file presented in the Lakehouse so it should not complaint about authentication.

 

LakehouseLakehouse

 

 

1 ACCEPTED SOLUTION

Hello,

   It worked! I I used the spark read api to load data from csv file from the lakehouse.

 

df = spark.read.format("csv").option("header","true").load("Files/churn/raw/churn.csv")
display(df)

Thanks,

Du

 

View solution in original post

2 REPLIES 2
dungtran12
New Member

Hello,

   I would like to update that it worked when I used the pandas read as  followed:

df = pd.read_csv("abfss://MinhTRanWorkspace@onelake.dfs.fabric.microsoft.com/MinhTRanLakehouse.Lakehouse/Files/churn/raw/churn.csv")
df.head()

 However, the Spark read still did not work. It still complaint about authentication failed and not presented in the request when reading a CSV file

 

{"error":{"code":"Unauthorized","message":"Authentication Failed with Bearer token is not present in the request"}}

Do you know what was missing with the Spark read?

 

Thanks,

Du

 

##df = (
##    spark.read.option("header", True)
##    .option("inferSchema", True)
##    .csv("/lakehouse/default/Files/churn/raw/churn.csv") 
##    .cache()   
##)


df = spark.read.format ("csv").option("header","true").load ("/lakehouse/default/Files/churn/raw/churn.csv")

 

 

Hello,

   It worked! I I used the spark read api to load data from csv file from the lakehouse.

 

df = spark.read.format("csv").option("header","true").load("Files/churn/raw/churn.csv")
display(df)

Thanks,

Du

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

June FBC25 Carousel

Fabric Monthly Update - June 2025

Check out the June 2025 Fabric update to learn about new features.