cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
VasylV
Frequent Visitor

Enhanced Microsoft SQL Server connector cannot authenticate to On-Premise Sql Server

Hi 

 

I have switched on "Allow Enhanced Microsoft SQL Server connector" and after this my app stopped working.

The app uses On-Premise Sql Server with Sql Server authentication.
All requests to data source returns:

 

 

 

{
  "duration": 155.77,
  "size": 237,
  "status": 401,
  "headers": {
    "Cache-Control": "no-cache,no-store",
    "Content-Length": 237,
    "Content-Type": "application/json",
    "Date": "Wed, 27 Nov 2019 10:51:50 GMT",
    "expires": -1,
    "pragma": "no-cache",
    "strict-transport-security": "max-age=31536000; includeSubDomains",
    "timing-allow-origin": "*",
    "x-content-type-options": "nosniff",
    "x-frame-options": "DENY",
    "x-ms-apihub-cached-response": true,
    "x-ms-request-id": "7b74b9f9-33a2-4af5-8bb9-1bd6b952c94a",
    "x-ms-user-agent": "PowerApps/3.19111.33 (Web AuthoringTool; AppName=4a938564-807e-49cb-bb49-eea971aa03d4)",
    "x-ms-client-request-id": "7b74b9f9-33a2-4af5-8bb9-1bd6b952c94a"
  },
  "body": {
    "status": 401,
    "message": "Permission Exception.\r\n     inner exception: Internal error: dataSourceCredentials\r\nclientRequestId: 7b74b9f9-33a2-4af5-8bb9-1bd6b952c94a",
    "source": "sql-eus2.azconn-eus2.p.azurewebsites.net"
  }
}

 

 

 

When switch that feature off the app works fine - there is no problem with data sources.

Should I configure something else to make it works with "Enhanced Microsoft SQL Server connector"?
Does "Enhanced Microsoft SQL Server connector" works with On-Premise Sql Server?

1 ACCEPTED SOLUTION

Accepted Solutions
VasylV
Frequent Visitor

I have resolve this issue with existing app - the problem was in these 2 settings, they were off in my app. 

After I have switched them on and then removed and added again all Sql Server Data Source it starts working correctly with On-Premise Sql Server with Enhanced Sql Connector.

 

PowerAppsSettings.png

 

Looks like some bug in PowerApps Studio - it should warn that this settings also should be on.

View solution in original post

10 REPLIES 10
Pstork1
Dual Super User III
Dual Super User III

Two things.

 

1) When you turn on that switch in settings it should give you an error if you have any existing SQL connectors in the App.  That switch can only be turned on when the app doesn't already have SQL connectors.  Did you remove and re-add the connectors after turning that feature on?

2) The enhanced connector adds support for Azure AD accounts, which doesn't mean anything for an on-premises installation. So I don't think its designed to work with on-premises SQL.

 

What enhancement are you hoping to get from the connector?  All the enhancements are designed for a cloud environment.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
VasylV
Frequent Visitor

Thank you for your answer.

1. Yes I have removed all data sources before turning that feature on then recreated them, otherwise it doesn't allow switch that flag

 

2. Enhanced connector also adds support timezone independent support for datetime and datetime2 which we needs as we develop on azure sql server but deploy to On-Premise sql server.

Also I assume that Enhanced connector is new version of the current connector and it just brings new feature and eventually replace old one. Isn't my assumption correct?
There is no information that it is design only for cloud and doesn't work with On-Premise sql server.
This more looks like bug in the connector.

Actually there is no much information about Enhanced Connector all I can find is this blog post https://powerapps.microsoft.com/en-us/blog/azure-active-directory-authentication-in-the-sql-server-c...

 

I would appropriate if you point me on some other documentation. 

Pstork1
Dual Super User III
Dual Super User III

I agree there isn't much information.  Its my understanding it really only adds two things, Azure AD logins and timezone independent support. Neither of those mean anything outside Azure. I'm not aware of any improvements to the underlying connector.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
VasylV
Frequent Visitor

I think it would be really useful to have consistent support datetime for both On-Premise and Azure Sql Server.

I hope PowerApps team will fix Enhance Connector to work with On Promise Sql.

v-siky-msft
Community Support
Community Support

Hi @VasylV ,

 

Can you manage to create the connection? Which request did you call from the SQL? Could you share more codes or screenshots?

I have made a test on my side, but I can't reproduce your issue. I can manage to connect to On-premise SQL DB by SQL server or window authentication after I switched on "Allow Enhanced Microsoft SQL Server connector" .

I recommend you to delete the connection, and change window authentication to re-create the connection again. If this doesn't make sense, please post more details.

Best regards,

Sik

 

 

Yes I created connection to On-premise SQL DB using Sql Server authentication

and it works fine with PowerApps when "Allow Enhanced Microsoft SQL Server connector" is off.

But when switch the option on it stop working - all requests to DB contains authentication error.

This happens also in environment of our customer so this is not problem with my environment only.

 

Unfortunately I cannot check Windows Authentication my machine is no in domain and is doesn't work.

Hi @VasylV ,

 

First, this feature does work with On-Premise SQL Server, and it works fine on my side, so I believe something weird in your SQL connection.

Then, the error shows Status 401 error. Generally, status 401 means the Unauthorized Error, so my suggestions are as follows: 

1. Remove all possible sql conections, which are linked to the app. Take care. The SQL Connection should all be deleted. Sometimes the System hangs and does not clear a sql connection.

2. Uninstall On-premises data gateway, 

3. After this step, take a little break. Maybe the background needs some time.

4. Clear Browser cache, re-install the gateway, add the connection threw the Power Apps Portal (View/Connection/Add Connection).

5. Create a new canvas app, connect to SQL database and check if your issue still remain.

Best regards,

Sik

Hi @v-siky-msft 

 

Thank you for your answer.

 

You are right it works with new application fine but I still cannot make it work for my existing application.

I have tried to remove and recreate all datasource and this haven't solve the problem.

Also I have gone through application settings and change them to default but this doesn't fix that problem.

 

Any ideas what else can be wrong with my app?

 

VasylV
Frequent Visitor

I have resolve this issue with existing app - the problem was in these 2 settings, they were off in my app. 

After I have switched them on and then removed and added again all Sql Server Data Source it starts working correctly with On-Premise Sql Server with Enhanced Sql Connector.

 

PowerAppsSettings.png

 

Looks like some bug in PowerApps Studio - it should warn that this settings also should be on.

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (82,976)