web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Power Apps and Azure S...
Power Apps
Unanswered

Power Apps and Azure SQL server connection via Azure AD integrated authentication type

(0) ShareShare
ReportReport
Posted on by 10

Hi,

I am trying to connect Power Apps with Azure SQL Database and using the SQL Server connector. We want to use the Azure AD integrated authentication - believe this is the recommended approach. However when trying to connect getting the following error.

Credentials are missing or not valid.
inner exception: The credentials provided for the SQL source are invalid.

 

I am already logged in using my same account to Power Apps maker portal as well, still getting this error.  Also, am able to connect with Azure AD authentication from Azure Data Studio. So there should not be a problem at Azure SQL server end.

 

Please suggest.

Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    68,707 Most Valuable Professional on at

    Did you create your SQL connection from inside the Power App Data sources?  Or from the connections tab in Power Apps?  If you do it from Data sources I think the dialog defaults to the old way, which only uses SQL mixed mode authentication.  But if you pre-create the connection in the Power Apps > Data > Connections you get the option to specify AD Authentication.  I suspect yours is defaulting to the wrong authentication type.

    image.png

  • singhdeven Profile Picture
    10 on at

    I followed the steps that you suggested and am now getting a different error message, please see below. I have cross checked the Azure SQL server name and DB name multiple times and tried a few times to refresh and connect however get his same error.

    {
     "error": {
     "code": 502,
     "source": "europe-001.azure-apim.net",
     "clientRequestId": "25868f8c-6128-448f-8209-2436c3a53b42",
     "message": "BadGateway",
     "innerError": {
     "status": 502,
     "message": "Unexpected Exception : Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: h. Path '', line 0, position 0.\r\n at Newtonsoft.Json.JsonTextReader.ParseValue()\r\n at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)\r\n at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)\r\n at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)\r\n at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)\r\n at Microsoft.Azure.Connectors.Common.Profile.TokenHeaderInformation.GetProperty[T](String key) in X:\\bt\\1024456\\repo\\src\\source\\common\\Profile\\TokenHeaderInformation.cs:line 81\r\n inner exception: Unexpected character encountered while parsing value: h. Path '', line 0, position 0.\r\nclientRequestId: 25868f8c-6128-448f-8209-2436c3a53b42",
     "error": {
     "message": "Unexpected Exception : Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: h. Path '', line 0, position 0.\r\n at Newtonsoft.Json.JsonTextReader.ParseValue()\r\n at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)\r\n at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)\r\n at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)\r\n at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)\r\n at Microsoft.Azure.Connectors.Common.Profile.TokenHeaderInformation.GetProperty[T](String key) in X:\\bt\\1024456\\repo\\src\\source\\common\\Profile\\TokenHeaderInformation.cs:line 81\r\n inner exception: Unexpected character encountered while parsing value: h. Path '', line 0, position 0."
     },
     "source": "sql-ne.azconn-ne.p.azurewebsites.net"
     }
     }
    }

     

  • Pstork1 Profile Picture
    68,707 Most Valuable Professional on at

    Check where you entered the server name to make sure there isn't a leading space.  The error is suggesting there is a ' ' at the beginning of the path name for the server.

  • singhdeven Profile Picture
    10 on at

    Hi,

    There is no leading space with the server name. However now I have added the Power Apps IP Addresses white listing in the Azure SQL Server firewall settings and now get the same error as in the first post above i.e.

    Credentials are missing or not valid.
    inner exception: The credentials provided for the SQL source are invalid.

     

    How can the credentials be invalid since the SQL connector authenticated successfully with Azure AD integrated however when selecting the connection and adding the SQL Server and database to connect gives the above error.

    Please suggest?

  • Pstork1 Profile Picture
    68,707 Most Valuable Professional on at

    One last thought.  This is turned on by default in Power Automate, but its still considered a Preview feature in Power Apps.  Did you enable it in Settings for the App?  See the screenshot below.

    image.png

  • singhdeven Profile Picture
    10 on at

    This is turned on by default in Power Apps too now. Earlier when it was in preview it was turned off by default but now it is turned by default and it was on for my app as well. Anyway I tried setting it to off and back on and then check the connection again however still the same error.

  • Community Power Platform Member Profile Picture
    on at

    Did you solve the issue, singhdeven? I'm experencing the same problem now.

  • singhdeven Profile Picture
    10 on at

    No, we had raised a ticket with Microsoft too and after a lot of discussions - the final conclusion was that it was not yet supported... 

  • Community Power Platform Member Profile Picture
    on at

    Pity. Thanks a lot for responding.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard