Why might you do this? In my case, I have connection string data and encryption passwords and I don't want them to swim around in code. In my case, by putting them into an Azure configuration setting, not only could they be changed on the fly, but they are hidden from developers who are either maintaining or reviewing your code and who you don't want to see these values.
I will cover other PHP in future posts but assuming you have a PHP app up and running on azure and you simply want to retrieve a value from the Configuration Settings, the first thing to note is that currently (April 2013(, the latest github version of the Azure PHP SDK does NOT support the RoleEnvironment, which is pretty rubbish. It as a class and a function but these throw exceptions, both locally and on the cloud. The good news is that you can still obtain the older SDK from http://phpazure.codeplex.com/ and this works just fine. Currrently, I am only using this for configuration settings so obviously other things might not work as well.
- Download the zip file from codeplex and unpack the library folder to a relevant place in your web root. I am using Yii so I copied it into protected/vendors/microsoft.
- Use whatever you need to in order to locate this package from within your app, again for Yii, i had to use the line: Yii::import('application.vendors.*'); (note that the word application is required here even though it is not part of the path). If you have a vanilla PHP app, you will not need this.
- require_once('microsoft/windowsazure/WindowsAzure/RoleEnvironment.php'); (or whatever the path is!)
- Access the config setting thus: Microsoft_WindowsAzure_RoleEnvironment::getConfigurationSettingValue("SettingKey");
A quick note on adding these settings. Normally, you would do this in Visual Studio (and I don't know if this is possible just for the azure project in VS when using PHP) but basically, you need to edit the csdef file and add a section called