Wednesday, May 22, 2019

trouble with azure variables for connection strings

I've got an API deployed and working in azure via github. Problem is I want to utilize their varaibles so I do not push my connection strings to a public github repo. So I created my variables in azure

https://i.redd.it/hmku4tqewsz21.png

And two variables under app settings..

https://i.redd.it/wms4aukcwsz21.png

Here is the code i've tried using to access it -

string dbconn = Environment.GetEnvironmentVariable("SQLCONNSTR_DBConnectionString"); string dbconn = ConfigurationManager.ConnectionString["DBConnectionString"].ConnectionsString; string dbconn = Configuration.GetConnectionString("DBConnectionString"); 

None of these values work, they return NULL in local, but if I'm not mistaken these variables should be compiled during the deployment azure kicks off when I merge, so it shouldn't work on local...

And i've only attempted to access the connection strings for the db so far, once that works I will obviously move on to check the storage strings.

EDIT: My insights is showing 500 errors.

trouble with azure variables for connection strings Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team