Ok, as promised, let’s learn this.
This has always been part of the Q&A portion whenever I evangelize Windows Azure. “How can I edit just one file on my Azure based app?” either that or “Is there a way to RDP into my instance?”
My answer, as usual, starts with “it depends.” J because, really, the need for this depends.
Well it is possible, but ill-advised for most scenarios. I have never been a big fan of editing a single file on the webserver. There are numerous downsides to doing this, starting with having a rogue copy of a file outside of source control.
Another thing that one should consider is the fact that if you RDP into your Azure instance, your in premise copy of the file will not be synched to it. And when that instance closes down, you don’t have any more copies.
But on the other hand, there is still the scenario where all you want to do is replace the word “Submit” with “Go” in just one button. Re packaging and re-uploading the whole app would seem, well, too hard.
So let’s go into how to RDP into a Windows Azure app’s instance.
First of course is to run Visual Studio, in Admin Mode. Let’s go admin mode so I can show two of the available ways to enable RDP on a Windows Azure Hosted Service. Then we create a new cloud project.
I’ll just go for a barebones WebRole.
Ok. Nothing fancy here, just a barebones app but need to pause for something.
As mentioned, I will show two of the possible ways to deploy a Windows Azure application with RDP Enabled. Both are of course basically the same:
Create an App, Package it, Create a Certificate, Upload the Certificate to your Azure subscription, Enable RDP, tell your app that RDP is enabled.
For the first option, I will package the application, create and export a certificate, upload the certificate to the Azure instance, then deploy the app to Azure.
Right-click on the cloud project and choose Package
This will bring up the Package dialog where we will tick the “Enable Desktop for all Roles” checkbox; which is unchecked by default.
After you check that, it will ask you for a few items:
You will be presented with a dropdown list that says <Automatic> by default. Change that to “create..” and it will ask you for a friendly name for your certificate. Provide a name for the certificate.
Then provide credentials (User name, Password and Expiration Date). It is usually a good idea to choose a future date for the expiration. Here I chose the day after Christmas of 2012.. if the Mayan Calendar was wrong, then this date should be good. 😀
Clicking OK will close this dialog and then you can go ahead and Package the app.
This should open up Windows Explorer and show you where the package and config files for your app are located.
Before we continue, let’s take a look at what happened behind the scenes. A quick look at the “new” config file shows something like this:
value=“password is here, encrypted. I just changed it for the blog“ />
thumbprint=“this will be the thumbprint“
You will see a few changes, noticeably the Certificate entry and the settings for RemoteAccess. Yes you can do these changes by hand. You can also create a self-signed certificate, get the thumbprint and use that. But as one of my friends say “why would you want to do stuff that is automated for you?”
What these changes does for you is it assigns a certificate and ties it with your application through the Certificate node in the config. This means, when your app is uploaded to Windows Azure, you should already have that particular certificate already existing.
So, with this first method, the next thing we need to do is export the Certificate file and upload it to your instance.
Export using the certificate manager.
And after successful export, upload the certificate to your Azure instance by clicking Add Certificate and uploading the cert file you just exported.
Once you have that going, next thing to do is deploy your app to Azure!
Once it is ready, you will see that you can enable RDP and Connect.
And there you go! J
Next blog will be about how to do this using VS alone.