how to prevent azure function from using old connection string

tony 1 Reputation point
2021-09-01T22:08:54.053+00:00

We recently changed our azure sql server manager password.
We confirmed (multiple times) that all connection string configurations have the correct password.
I've exhausted my list of theories of what the root issue is, and don't even know where to look next.

This problem is intermittent and doesn't appear to be an issue with our app service UI, and appears to only happen in our .net azure functions.

It "feels" like a connection string my be stuck in a cache that survives between deployments.

Working with https://learn.microsoft.com/answers/users/3523114/albertomorillo.html in question https://learn.microsoft.com/en-us/answers/questions/527948/need-help-tracking-down-azure-sql-error-message-lo.html determined that our azure function were indeed trying to connect with an invalid connection string quite a bit more often then the functions are invoked, which I feel support my theory that this problem is something happening in abstracted code out of my control.

I really want to avoid rebuilding these function apps, so if anyone could give me some things to try or look into it would be greatly appreciated.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,929 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 70,941 Reputation points Moderator
    2021-09-02T04:04:45.613+00:00

    @tony Do you mean that after redeploying your function and configuration you still observe that it uses the old connection string?
    It "feels" like a connection string my be stuck in a cache that survives between deployments.

    It depends how you have define the connection string. If you have define it static client the it reuse client instances rather than creating new ones with each function invocation.
    But once you have changed the connection string (application setting) and restart your function then the static client should get the new connection string after the restart. Can you restart your function app and see if you observed the same issue.


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.