Forum Discussion
Fabric Snowflake connector returns "Invalid credentials" with Key-Pair despite valid key pair
- 2 months ago
Thank you v-saisrao-msft , I found the issue, in the connection it converted the server name to lower case although I added it in upper case, so when I used the lower case in the dataflow gen2 connection the connections I created in Settings > Manage Connections and Gateways appeared in the dropdown list. Thank you for your support
Hi melsheikh ,
I have done this worked as expected using dataflow and Pipeline.
One step you need do is --> First create the gateway connection using Keypair and then try use it in pipeline or Dataflowgen2.
**Also, Can you share the steps ,how you connected using Key Pair from Notebook. I am looking for that 🙂
Regards,
Pulendar
Hi Pulendar1
This is the notebook that works, where I was able to connect to snowflake from Fabric notebook
import snowflake.connector
con = snowflake.connector.connect(
account="OHHHHPJ-NT42852", user="MELSHEIKH",
private_key_file="/lakehouse/default/Files/rsa_key.p8",
warehouse="COMPUTE_WH", role="ACCOUNTADMIN",
insecure_mode=True)
cur = con.cursor()
cur.execute("SELECT * FROM SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.CUSTOMER LIMIT 1000")
cols = [c[0] for c in cur.description]
rows = cur.fetchall()
con.close()
spark.createDataFrame(rows, schema=cols) \
.write.mode("overwrite").saveAsTable("customer_from_snowflake")
print("Done — table 'customer_from_snowflake' written to the Lakehouse.")
And this is what I get when we try to connect to Snowflake from Fabric copy job. Invalid credentials.
We also tried with gateway and without gateway option.
Am I missing something?
- Pulendar12 months ago
Resolver I
Hi melsheikh ,
Thank you for sharing the script! Are you using snowflake with Privateend point or public network?
Also, regarding the copy job --> ***First create datasource in the gateway using Keypair and ensure successfully stored the datasource.
Step 2 : Then Create copy job while searching the source choose Gateway connection which you created in the step 1. It should work.
- melsheikh2 months ago
Microsoft Employee
Thanks Pulendar1
The connection works fine when I created it from settings > Manage connections and gatewaysI then reused the connection in a Copy Job and it works
However, in dataflow gen2, the connection I creatd in Manage Connections is not visible (not found in the dropdown list)
Is this a known bug in Fabric?- v-saisrao-msft2 months ago
Community Support
Hi melsheikh,
Since the Key-Pair connection works in Copy Job, the authentication is valid. For Dataflow Gen2, the documentation supports using the Power Query Online → Get data experience to create the connection and supports Key-pair authentication there. If the connection still isn't available or usable in Dataflow Gen2 through the documented flow, consider raising a Support ticket so the backend team can investigate the issue.
Set up your Snowflake database connection - Microsoft Fabric | Microsoft Learn
Data source management - Microsoft Fabric | Microsoft Learn
Create a Fabric and Power BI Support Ticket - Power BI | Microsoft LearnThank you.
- v-saisrao-msft2 months ago
Community Support
Hi melsheikh,
Checking in to see if your issue has been resolved. let us know if you still need any assistance.
Thank you.