Create Client (*.pem) Certificate
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem
Create Server (*.cer) Certificate
openssl x509 -inform pem -in mycert.pem -outform der -out mycert.cer
| { | |
| "require": { | |
| "guzzle/guzzle": "~3.1" | |
| } | |
| } |
| { | |
| "HostNameSslStates": [ | |
| { | |
| "Name": "[custom-domain-name]", | |
| "SslState": 0, | |
| "Thumbprint": "[ssl-certificate-thumbprint]", | |
| "ToUpdate": "true" | |
| } | |
| ] | |
| } |
| <Site xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> | |
| <HostNameSslStates> | |
| <HostNameSslState> | |
| <Name>[custom-domain-name]</Name> | |
| <SslState>Disabled</SslState> | |
| <Thumbprint>[ssl-certificate-thumbprint]</Thumbprint> | |
| <ToUpdate>true</ToUpdate> | |
| </HostNameSslState> | |
| </HostNameSslStates> | |
| </Site> |
| { | |
| "HostNameSslStates": [ | |
| { | |
| "Name": "[custom-domain-name]", | |
| "SslState": 1, | |
| "Thumbprint": "[ssl-certificate-thumbprint]", | |
| "ToUpdate": "true" | |
| } | |
| ] | |
| } |
| <Site xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> | |
| <HostNameSslStates> | |
| <HostNameSslState> | |
| <Name>[custom-domain-name]</Name> | |
| <SslState>SniEnabled</SslState> | |
| <Thumbprint>[ssl-certificate-thumbprint]</Thumbprint> | |
| <ToUpdate>true</ToUpdate> | |
| </HostNameSslState> | |
| </HostNameSslStates> | |
| </Site> |
| <?php | |
| require_once "vendor/autoload.php"; | |
| use Guzzle\Http\Client; | |
| $client = new Client( | |
| 'https://management.core.windows.net:443/', | |
| array( | |
| 'subscription' => '[SUBSCRIPTION-ID]', | |
| 'webspace' => '[webspace-name]', // eastuswebspace | westuswebspace | | |
| 'site' => '[web-site-name]', | |
| 'curl.options' => array ( | |
| 'CURLOPT_SSLCERT' => '[path-to-pem-certificate]' | |
| ) | |
| ) | |
| ); | |
| $client->setDefaultHeaders( | |
| array ( | |
| 'x-ms-version' => '2012-10-10', | |
| 'accept' => 'application/json' | |
| ) | |
| ); | |
| try { | |
| $request = $client->put('{subscription}/services/WebSpaces/{webspace}/sites/{site}'); | |
| $request->setBody(fopen([path-to-payload], 'r')); // You can replace this with a string version of the payload | |
| $response = $request->send(); | |
| echo $response->getBody(); | |
| } catch (Exception $ex) { | |
| echo $ex; | |
| } |
Create Client (*.pem) Certificate
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem
Create Server (*.cer) Certificate
openssl x509 -inform pem -in mycert.pem -outform der -out mycert.cer