Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading connection string from Azure website connection strings configuration

I have uploaded a azure webjob in a azure web site. I was trying to read a connection string from the azure website where the azure webjob is using below code but it is not returning anything. The connection strings in the azure websites are located in the configure tab of the azure website. Am I doing something wrong here.

CloudConfigurationManager.GetSetting("ConnString")

Thanks

like image 420
user505210 Avatar asked Oct 31 '14 13:10

user505210


People also ask

How do I get the connection string from Azure app configuration?

You can find the connection string under Access Keys of your App Configuration store in the Azure portal.

How do I get Azure connection string?

You can find your storage account's connection strings in the Azure portal. Navigate to SETTINGS > Access keys in your storage account's menu blade to see connection strings for both primary and secondary access keys.

How do I test Azure connection string?

You could click Tools>Connect to Database>Microsoft SQL Server>enter your server name, username and password about Azure Sql. Then click Test Connection button to check whether you could connect successfully.

How do I use connection string in Azure App Service?

Configure connection strings. In the Azure portal, search for and select App Services, and then select your app. In the app's left menu, select Configuration > Application settings. For ASP.NET and ASP.NET Core developers, setting connection strings in App Service are like setting them in <connectionStrings> in Web.


1 Answers

The CloudConfigurationManager.GetSetting("ConnString") is looking for a setting with the key "ConnString" in your App Settings within Azure rather than your Connection Strings.

You need to add a value in the App Settings for your Web Site which contains your connection strings

enter image description here

like image 149
AlexC Avatar answered Dec 08 '22 09:12

AlexC