How to Setup Windows Azure (Server 2012) as an SSTP and L2TP VPN Provider

1. Create new Windows Server VM using "Quick Create"
2. The DNS name, username and password will be used to connect to the VPN
3. A0 or A1 VM (starts at around $10/month or free with an MSDN subscriptionno charge for stopped VM, billed by the minute)
4. Add HTTPS endpoint (TCP 443)
5. Connect using Remote Desktop (RDP) through the Dashboard

---------- Server Role
1. Click on Server Manager -> Manage -> "Add Roles and Features"
2. Add "Remote Access", include VPN and Routing (needed for NAT) role services and restart
3. Click on Server Manager -> Notifications -> "Open the Getting Started Wizard"
4. Select "Deploy VPN only"

---------- Server Certificate
1. Open an elevated CMD prompt
2. Use SelfSSL (IIS6 Resource Kit, custom install only this component) to generate an SSL certificate for the SSTP:
selfssl.exe /N:cn=<...> /V:3650
(3650 == 10 years, "<...>" represents the fully-qualified domain name, FQDN)
3. Confirm prompt with "y", ignore metabase error (if it appears)
4. Open the Certificate Manager for Computer Account: certlm.msc
5. Click on Personal -> Certificates
6. Right-click on the <...> certificate, then on All Tasks -> Export, include private keys and protect with password

---------- Server RRAS
1. Run Routing and Remote Access (RRAS) tool
2. Right-click on the server and then on "Configure and Enable RRAS"
3. Choose "Custom configuration", select "VPN access" and NAT
4. Right-click on the server and then on Properties -> Security
5. Select the <...> certificate
6. Click on the IPv4 tab
7. Enter a "Static address pool" for the number of clients, e.g.: - (otherwise the connection will fail with error 720), then close the dialog
8. Don't enter a range that is too short. The OS keeps a lock on a used IP address for a while, so reconnecting often or from multiple devices may use up the pool and the connection will fail with error 0x8007274C
9. Expand the IPv4 node, then right-click on NAT, then on "New Interface", select the external interface (e.g. "Ethernet 2")
10. Click on "Public interface connected to the Internet" and check "Enable NAT on this interface"

---------- Server User
1. Open "Computer Management" (compmgmt.msc) console
2. Click on "Local Users and Groups", then on Users, double click on your account
3. Click on Dial-in and change "Network Access Permission" to "Allow access"

---------- Client Certificate
1. Double-click on the exported pfx server certificate file and install to client's "Local Machine" store, if you store the certificate in the personal store, the connection will fail with error 0x800B0109
2. Click on "Place all certificates in the following store", then on Browse
3. Select "Trusted Root Certificate Authorities"

---------- Client Connection
1. Go to Network and Sharing Center, click on "Setup a new connection or network"
2. Select "Connect to a workplace", then VPN
3. Enter <...>, name and create
4. Click on Network tray icon
5. Right-click on new VPN connection, then show properties
6. Click on Security, set VPN type to SSTP and allow only MS-CHAP v2
7. Connect using same credentials used to create the VM and for RDP
8. Test your internet connectivity
9. Use a web site that shows your external IP, it should be an IP from the Azure datacenter

---------- SSL Certificate
To avoid installing a self-certificate to the trusted store (or for devices with a locked trusted store), do the following:
1. Open the IIS Manager on the server
2. Click on the server, then on "Server Certificates"
3. Click on "Create Certificate Request" (Certificate Signing Request, CSR)
4. Enter <...> as the "Common name", fill the rest and export as text file
5. Buy an SSL certificate using the CSR (cheap SSL certificates start at around $5/year)
6. Once the SSL authority issues the certificate:
a) Install to the server's and client's "Local Machine" personal store as described above, skipping the step to copy/move it to the trusted store
b) Select the same certificate in the RRAS tool, on the Security tab

---------- L2TP over IPsec
1. On the Azure Portal, add the following endpoints:
a) L2TP UDP: 1701
b) IPsec UDP: 500
c) IKEv2 UDP: 4500
2. On the Server, open the "Windows Firewall with Advanced Security" (WF.msc), create a rule called IKEv2 and allow inbound traffic to UDP port 4500 (otherwise the connection will fail with error 809)
3. Using the RRAS tool, right-click on the server and then on Properties -> Security
4. Check "Allow custom IPsec policy for L2TP/IKEv2 connection" and enter a preshared key
5. On the client, right-click on new VPN connection, then show properties
6. Click on Security, then on click on "Advanced settings" and enter the same preshared key

For help, see Troubleshooting common VPN related errors.

DISCLAIMER: This solution is provided "AS IS," without any warranty or representation of any kind. Please note that, as of June 2014, this solution is not yet officially supported by Microsoft.