Forum Discussion

justincarter's avatar
justincarter
Regular Visitor
2 months ago
Solved

Snowflake Connector Fails in Power Query / Does Work in Workplace Connection Settings

Hello,

 

When I am editing my snowflake query in power query (service), I am getting the error "We could not evaluate this query due to invalid or missing credentials."  I put in the credentials I have but it doesn't work.  I'm using Key/Pair authentication.

At the same time, in my workplace "Manage Connections and Gateways" -> "Connections" the snowflake connection is showing as Online and checking status continues to show Online.  If the key had rotated I would expect that to fail as well.


Why the discrepency?

 

I know my snowflake table has changed and I need to rename some fields but I don't get why that would cause a credential error.  Outside of power query when I do a manual data refresh of my semantic model I am getting a field mismatch (known), (and not a credential problem) but I am running into issues on how to change it since I need to be able to connect to save changes to the M code for renaming.

 

Also - the connection is a direct cloud connection so it doesn't go through the on-prem data gateway.

 

Thanks,

Justin

  • Hi justincarter ,

    Thank you for reaching out to the Microsoft Community Forum. You are facing a mismatch between “connection-level credentials” and “dataset/query editor credentials” in Power BI / Fabric with Snowflake + key pair auth + Direct cloud connections. It is not a credential problem It’s a schema mismatch causing query evaluation failure, which Power Query incorrectly reports as a credential error.

     

    Please try below general workarounds to fix the issue.

    1. Temporarily bypass schema validation: Open Power Query --> Go to Advanced Editor, modify your query to avoid immediate column dependency. Please refer below sample code.

    let
    Source = Snowflake.Databases(...),
    Table = Source{[Name="Table"]}[Data],
    #"Keep Columns Safe" = try Table otherwise Table
    in
    #"Keep Columns Safe"

    Then Save, Re-open and fix column names step-by-step.

    2. If you know the column changes, Open Advanced Editor --> Update renamed fields manually in M code: Table.RenameColumns and Table.SelectColumns. Please refer below sample code.

    Table.RenameColumns(Source, {
    {"old_name", "new_name"}
    })

    3. Go to: Dataset settings --> Data source credentials. Click Edit credentials, Re-enter key pair auth details and Save.

    4. Duplicate the query (M code), Delete original Snowflake source step, Reconnect fresh and Reapply transformations.

     

    I hope this information helps. Please do let us know if you have any further queries.

     

    Regards,

    Dinesh

     

     

2 Replies

  • v-dineshya's avatar
    v-dineshya
    Community Support

    Hi justincarter ,

    Thank you for reaching out to the Microsoft Community Forum. You are facing a mismatch between “connection-level credentials” and “dataset/query editor credentials” in Power BI / Fabric with Snowflake + key pair auth + Direct cloud connections. It is not a credential problem It’s a schema mismatch causing query evaluation failure, which Power Query incorrectly reports as a credential error.

     

    Please try below general workarounds to fix the issue.

    1. Temporarily bypass schema validation: Open Power Query --> Go to Advanced Editor, modify your query to avoid immediate column dependency. Please refer below sample code.

    let
    Source = Snowflake.Databases(...),
    Table = Source{[Name="Table"]}[Data],
    #"Keep Columns Safe" = try Table otherwise Table
    in
    #"Keep Columns Safe"

    Then Save, Re-open and fix column names step-by-step.

    2. If you know the column changes, Open Advanced Editor --> Update renamed fields manually in M code: Table.RenameColumns and Table.SelectColumns. Please refer below sample code.

    Table.RenameColumns(Source, {
    {"old_name", "new_name"}
    })

    3. Go to: Dataset settings --> Data source credentials. Click Edit credentials, Re-enter key pair auth details and Save.

    4. Duplicate the query (M code), Delete original Snowflake source step, Reconnect fresh and Reapply transformations.

     

    I hope this information helps. Please do let us know if you have any further queries.

     

    Regards,

    Dinesh

     

     

    • justincarter's avatar
      justincarter
      Regular Visitor

      Thanks for your suggestions Dinesh I used this as part of my solution.  In addition to schema issues I learned my snowflake connection was only allowed from certain IP addresses so that was also part of my problem.  Thanks again for your response.