Reputation: 350
In my c# solution I am accessing my storage account through a connection string.
Issue -
one way i was thinking was use of vault .. any other idea ? Please guide. Thanks.
Upvotes: 2
Views: 443
Reputation:
I see you are using Azure DevOps.
The old "config transforms" of yesteryear are arguably deprecated now with continuous deployment (CD). Essentially your connection string represents a "secret" or at least something that is stage-dependent and generally stage dependant items should not be part of the source code's repository. Sure you can put them in but its much easier to manage in CD.
Instead, whoever is defining the CD pipeline defines it in other means such as DevOps CD variables and injects it into your config after the code has been compiled but just prior to deployment
Upvotes: 1
Reputation: 1278
I assume you are talking about a Web App where you are using Storage Account Connection string.
Usually, it's a good practice to have your connection string in a config file (web.config for .Net Framework and appsettings.json for .net core).
However, though these work in Azure App Service, they are kind of deprecated. So, you need to create App Settings / Connection Strings (go to Configuration blade in App Service) for your Storage Connection.
You didn't mention what kind of application you have in your solution. Based on the type you can use the below appropriate technique to access the App Settings/ connection strings.
Thanks, Praveen
Upvotes: 3
Reputation: 58931
There are at least two things you should do.
Use the Options pattern in ASP.NET Core to retrieve your settings like connections strings. This will, for example, use your appsettings.json if you work locally and it will overwrite these settings with environment variables you are setting in Azure. This mean, you don't have to worry where your settings come from.
Configure connection strings in your App Service application.
Also consider using Key Vault references for App Service settings
Upvotes: 2