This post is written in English for the benefit of search engines.
I had a client meeting this week where we deployed a PHP based solution to Windows Azure. One of the issues we faced was accessing Local Storage on an Azure VM from PHP. In a .NET environment this is done by getting a LocalResource instance from the RoleEnvironment object, then querying the RootPath property of the LocalResource instance.
So I whipped up a quick utility that helps to do this. It is a .NET command line program that reads the RootPath and either writes it to an environment variable or prints it to its output. The environment variable or the printed output can then be accessed from PHP code (or from any other code, for that matter) and the Local Storage can be used.
“Usage: GetAzureLocalResource [ResourceName] [VariableMode]
This will get the [ResourceName] local resource’s root path and write it to the LR_[ResourceName] environment variable. [VariableMode] can be User, Process, Machine or PrintOnly; the environment variable will be written to the specified store, or only printed to the output. Exception information is written to the LR_ERROR machine environment variable.
GetAzureLocalResource Res1 Machine — Gets the Res1 local resource’s root path and writes it to the LR_Res1 machine environment variable.”