Create an RDP file Download Link for an Azure VM

Just because it’s Friday, here’s a route for express (Node.js web framework) which will give you the RDP file for a VM in Azure:

app.get("/rdp/:address", function(req, res){
  res.setHeader('Content-Type', 'application/x-rdp');
  res.setHeader('Content-Disposition', 'attachment; filename=' + req.params.address + '.rdp');
  res.end("full address:s:" + req.params.address + ":3389\r\nprompt for credentials:i:1");

To use, add the above lines to your express application and the link below in your web page:

<a href="/rdp/">Remote Desktop</a>

(obviously replacing with the name of your hosted service)