Overwrite file_directory_temp function without touching the core?
Code for variable_get() is:

function variable_get($name, $default = NULL) {
  global $conf;
  return isset($conf[$name]) ? $conf[$name] : $default;
}


So if value is constant during one page call you need to set:

global $conf;
$conf['file_temporary_path'] = Microsoft_WindowsAzure_RoleEnvironment::getLocalResource('Temp') . $conf['file_temporary_path'];


If value can change for each request, you need a more bold move. And  PHP 5.2.0 or later.

class TempClass {
  private $path;
  public function __construct($path) {
    $this-&gt;path = $path;
  }
  public function __toString() {
    return Microsoft_WindowsAzure_RoleEnvironment::getLocalResource('Temp') . $this-&gt;path;
  }
}
global $conf;
$conf['file_temporary_path'] = new TempClass($conf['file_temporary_path']);


That way you'll have an object, that will be converted to string on each use, and on that conversion will retrieve current value from Microsoft_WindowsAzure_RoleEnvironment class.

Where to put it?

Best place for it seems to be a hook_boot(). You need to make sure your hook_boot() is called first. To get your module to run first, use hook_module_implements_alter() or easier and less reliable way - Modules weight module.

If you don't care about the value provided via UI, you can (maybe should) put it in settings.php instead, and substitute reads from $conf['file_temporary_path'] with hard-coded value. You don't need to use global in settings.php.

Conflict with UI

When you open form to edit file_temporary_path, you will see value with Azure's prefix string already prepended. That's not what you want there, as multiple saves would prepend it multiple times. Use hook_form_alter() to change default value to one obtained directly from the database, or, if you hardcoded it in settings.php, to set it to hardcoded string and disable field.