Databricks to snowflake data load
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2025 04:19 AM
Hi Team,
I’m trying to load data from Databricks into Snowflake using the Snowflake Spark connector. I’m using a generic username and password, but I’m unable to log in using these credentials directly. In the Snowflake UI, I can only log in through “Sign in with Azure AD.”
Below is the code snippet I’m using:
sfOptions = {
"sfURL": "XD1.privatelink.snowflakecomputing.com",
"sfDatabase": "Z_AICS",
"sfSchema": "ASK_SMG",
"sfWarehouse": "WAGT_ETL",
"sfUser": "sys_aski@xyz.com",
"sfPassword": "Qtr3tdint$",
"sfRole": "AZURE_DATA_PLATFORMS"
}
selected_df.write \
.format("snowflake") \
.options(**sfOptions) \
.option("dbtable", "DIM_TOPIC") \
.mode("overwrite") \
.save()
However, I’m getting the following error:
> Incorrect username or password was specified.
Could anyone please suggest how to authenticate and connect Snowflake from Databricks when Azure AD SSO is required for login?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2025 05:53 AM - edited 10-28-2025 05:56 AM
@SuMiT1 The recommended method to connect to snowflake from databricks is OAuth with Client Credentials Flow.
This method uses a registered Azure AD application to obtain an OAuth token without user interaction.
Steps:
- Register an app in Azure AD and configure it for Snowflake OAuth integration.
- Create a security integration in Snowflake using the client credentials.
- Use the token in your Spark job.
Here is the full guide.
Other option is OAuth with User Credentials Flow (Interactive Login)
This method uses a user's Azure AD credentials to obtain a token. It's less ideal for automation but works for interactive sessions.