Database connection string search script

I am a Continuity Management consultant, and work with app and infrastructure resources to create and validate recovery/resiliency plans. When testing these plans often an incorrectly compiled database connection string prevents connectivity between the data and other app layers. In a real event this issue could hinder recovery within the required timeframe.

My experience is in infrastructure; I could not code my way out of a wet paper bag. I'm shooting in the dark with this question as I have no idea if it's even possible or feasible: can a script be created to search application code for the database connection string? Or can strings be created with different formats in the same app code, such that a search would not be possible?

I appreciate anyone's response here.

1 answer

Please see https://www.connectionstrings.com/store-and-read-connection-string-in-appsettings-json/ explaining one way to store the connectionstrings for a .NET Core application. This is a preferred way of doing it. However there are many variants to this and your suggested approach could never cover 100% IMHO. Also the settings names and locations can differ. However maybe it is possible to cover some of the cases and your suggested tool could be useful at least.