Condividi tramite


Azure App Service: How to read & parse connection strings via PHP

On Azure App Service, developers have the ability to configure the connection strings as key-value pair under App Settings section. Here is a sample screenshot:

image

At runtime, Azure App Service retrieves this key-value pair for you and makes them available to your hosted application. These are provided to the web app as Environment Variables.

Here is a good article on how to these work internally: How Application Strings and Connection Strings Work

Here is a sample code on how to read the app settings in PHP

Summary

The sample code is a way to get started on how to retrieve the connection strings at runtime in PHP. I have used the above sample to read from a database and display it on a page. The project is hosted on GitHub. See here: https://github.com/kaushalp/Problematique/edit/master/ProblematicMvc/client.php