After Deployment in Azure function - Internal server error 500 (exception caught attempting to connect to SQL DB)

Reshma 0 Reputation points
2025-06-17T12:39:07.56+00:00
  • Create Azure Resources:
    • Azure Function App: Create an Azure Function App in the Azure portal.
    • Key Vault: Set up an Azure Key Vault to store your sensitive information like passwords securely.
    • Azure SQL Database: Create an Azure SQL Database in the Azure portal.
  • Configure Key Vault:
    • Store the secret password securely in Azure Key Vault.
  • Develop Azure Function:
    • Visual Studio: Develop an Azure Function with HTTP trigger in Visual Studio.
    • HTTP Trigger: Implement an HTTP trigger function that will receive HTTP requests.
  • Access Key Vault Secret:
    • Use Azure Function's Managed Identity to access Key Vault secrets securely without storing credentials in code.
    • Retrieve the secret password from Key Vault within your Azure Function code.
  • Connect to Azure SQL Database:
    • Use ADO.NET or Entity Framework within your Azure Function to connect to the Azure SQL Database.
    • Perform data retrieval or other operations based on the secret password verification.
  • Verify and Respond:
    • Verify the secret password retrieved from Key Vault with the one stored in Azure SQL Database.
    • If verified, retrieve data from the database.
    • Construct a response from the Azure Function based on the database query results.
  • Return Response to User:
    • Send the response back to the user who initiated the HTTP request.

Once these steps done I have deployed to the Azure Function. But when I run the code I am getting the Internal server error.

If I run the python program locally I am getting result, but after deployment I am getting this error.

Developer technologies | Visual Studio | Extensions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.