Editing a Single file on a Windows Azure Application using Remote Desktop

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:

<ConfigurationSettings>

<Setting
name=Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString
value=UseDevelopmentStorage=true />

<Setting
name=Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled
value=true />

<Setting
name=Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountUsername
value=rdpadmin />

<Setting
name=Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountEncryptedPassword
value=password is here, encrypted. I just changed it for the blog />

<Setting
name=Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountExpiration
value=2012-12-26T23:59:59.0000000+08:00 />

<Setting
name=Microsoft.WindowsAzure.Plugins.RemoteForwarder.Enabled
value=true />

</ConfigurationSettings>

<Certificates>

<Certificate
name=Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption
thumbprint=this will be the thumbprint
thumbprintAlgorithm=sha1 />

</Certificates>

 

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.

 

 

 

Advertisements
This entry was posted in Computers and Internet. Bookmark the permalink.

8 Responses to Editing a Single file on a Windows Azure Application using Remote Desktop

  1. Doyle says:

    i have three words for this. its “great” , “great” , “great!!!”

  2. Pingback: Windows Azure and Cloud Computing Posts for 12/16/2011+ - Windows Azure Blog

  3. zxcz says:

    Awesome !

  4. User says:

    Good article but can u give us any direct way so we can upload it thru FTp or website

    Thanks
    Saraswati Pg College

  5. Hey!

    I’m just getting started with my first Azure app. Here’s something which I wanted to implement as my first application:
    I want to create a service on Microsoft Azure using Visual Studio 2012 which enables various users to upload and edit their documents. I’ve found some tutorials online but all of them include downloading that particular document and then uploading it back again on the cloud. I want the users to be able to edit it online without the need of downloading the document and then submitting it after the required changes are made.

    Please let me know if there are any useful links which I can refer to.

    Thanks a lot.

  6. pallavi says:

    I’m just getting started with my first Azure app. Here’s something which I wanted to implement in my first application:
    1. The first page allows various users to login, each user given their own username.
    2. Once they’ve logged in, they would be able to upload their documents which will be stored in the Windows Azure Blob. Each document would have a particular id.
    3. All the documents which have been uploaded on the Blob will be visible to all the users. However, if a user wishes to edit a particular document, he will need the document id to access it.
    4. Once he’s given access, he’ll be able to edit the document just like Google docs and save changes after he’s done.
    5. The last feature is something which will depend on how quickly I get the first 4 steps done. I was earlier thinking of collaborative editing but that would be a little out of my scope right now as I’m a beginner. An alternative to this would be to restrict access to a user if he’s trying to open a document which has already been opened by some other user.

    I would like to implement all of this on Microsoft Visual Studio 2012 using Visual C# and ASP.net. I’ve already created the free Azure cloud.
    Please let me know how to get started or if any of you know any useful links which I can refer to.
    Thanks a lot.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s