Search code examples
visual-studioazure-functionsazure-sql-databaseazure-managed-identity

Connecting C# Azure Function with Azure SQL using User-Managed Identity. Authentication Failed


Connecting C# Azure Function with Azure SQL using User-Managed Identity. Authentication Failed


Solution

  • Connecting C# Azure Function with Azure SQL using User-Managed Identity. Authentication Failed

    Normally, the Connection String varies based on the type of authentication where User ID and Authentication Values will be varied.

    enter image description here

    As @Scott Mildenberger suggested that MS Doc that states to add the attribute User Id=ClientIdOfManagedIdentity in the Connection String of Database Server when specifying the application configuration settings.

    In your case also, Authentication and UserId values are set to be Active Directory Managed Identity and ClientIdOfManagedIdentity and then it has to be deployed to reflect the changes and work.