Friday, March 16, 2012

Howto: configure WebDAV on Windows Azure WebRole instance

 

One day you may decide to configure WebDAV on your Windows Azure WebRole instance: for example, to perform file uploads without Azure deployments. BTW, be aware: all uploaded to WebRole instance files which do not exist in the deployment package are irreversible gone when the instance is migrated to another Azure host node or restarted.

But while the instance is running you may use the files uploaded via WebDAV.

Why we use WebDAV on Azure? Well, there was a business process to upload the Web content files to the former hosting platform prior to Windows Azure. The deployment chain includes a WebDAV upload and the tools are configured. Additionally,the uploaded files can be used immediately.With an usual Azure deployment package there is an instance outage for approximately 10-15 minutes. We need to update the files multiple times a day and use WebDAV to provide quick access to updated content files. Once uploaded via WebDAV the files can be accessed immediately. Additionally we update these files to deployment package and deploy then this package overnight while the outage of instance is not so critical.

Here are steps to activate and configure WebDAV on Windows Azure WebRole.

Configure Windows Server 2008 R2 as instance OS

First, be sure you use Windows Server 2008 R2 as instance OS. Windows Server 2008 has no WebDAV setup package out-of-box and requires download and setup of WebDAV modules. Windows Server 2008 R2 has WebDAV setup as feature package and requires only activation and configuration.

To ensure and configure right version of OS launch Windows Azure management portal and open popup menu on the selected deployment:

image

In popup menu select “Configure OS”:

image

You may see Windows Server 2008 SP2 as current OS version:

image

Select “Windows Server 2008 R2” and confirm with “OK”:

image

The system needs some time to be reconfigured:
image

All instances will be updated:

image

After all the instances are reconfigured you may use RDP to open terminal session to each instance to ensure configured OS version. The manual for RDP configuration on Azure is here: http://msdn.microsoft.com/en-us/library/windowsazure/gg443832.aspx

You will need RDP to each instance for WebDAV configuration. Use “Connect” button in management portal:

image

You should see the server configuration window with the current OS version information:

image

Alternatively you can start “winver”:
image

…and see the OS version:
image

Activate WebDAV

WebDAV is a feature of IIS and can be activated via Server Manager:

image

Select “WebDAV” in Role Services:

image

Confirm installation:

image

The installation process begins:

image

Configure WebDAV

Configure WebDAV for Website using IIS Manager:

image

Select “WebDAV Authorization rules” in IIS features of the Website:image

Enable WebDAV for the Website:

image

Once WebDAV is enabled, the option to disable WebDAV appears:

image

Add authorization rule to provide access to the file system, select content type, user(s) and permissions:

image

Review configured rules:

image

Do not forget to enable Windows Authentication on Website – otherwise the WebDAV users cannot login. Use “Authentication” IIS feature of the  Website:

image

Enabled Windows Authentication looks like:

image

Complete!

Access WebRole instance using WebDAV

From now you can access file system on WebRole instance using WebDAV. On the client open Windows Explorer:

image

Select “Map network drive”:

image

Select “Connect to a Web site…”:

image

Add network location:

image

Specify URL to the WebRole where WebDAV is enabled and configured:

image

Enter user login and password when prompted (use credentials you configured in WebDAV authorization rules):

image

Windows Explorer opens the location you configured:

image

You can use ordinary file system functions to upload to or download from WebRole instance.

Enjoy!

No comments: