private function _encodeConfiguration($value)
    {
        $value = is_resource($value) ? stream_get_contents($value) : $value;
        $value = base64_encode($value);

        // Cut the BOM if any. If the xml configuration would start with BOM Azure treats it as invalid XML file.
        if (strpos($value, '77u/') === 0) {
            $value = substr($value, 4);
        }

        return $value;
    }