Recently I was looking at a forum question of someone trying to add a disk to the Azure Virtual Machines using the Windows Azure REST API.

You have two types of Disks.  You have a Data Disk that do not have an operating system and are used to store user files.  You also have OS Disks.  The OS Disks contain the operation system and is the main disk used when creating an Azure Virtual Machine.

These can be created using the REST API, PowerShell, or the Management Portal. 

The REST API documentation outlines the following body for the post to create a new disk.

<Disk xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
   <HasOperatingSystem>true|false</HasOperatingSystem> 
   <Label>disk-description</Label>
   <MediaLink>uri-of-the-containing-blob</MediaLink>
   <Name>disk-mame</Name>
<OS>Linux|Windows</OS>
</Disk>

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

While these are the right items to send to create the Disk, the order matters if you want to create an OS Disk.  I found that the OS Element needed to be first in order to create an OS Disk vs. a Data Disk.

The correct body for the post to create an OS Disk should be:

<Disk xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
   <OS>Linux|Windows</OS>
   <HasOperatingSystem>true|false</HasOperatingSystem> 
   <Label>disk-description</Label>
   <MediaLink>uri-of-the-containing-blob</MediaLink>
   <Name>disk-mame</Name> 
</Disk>

Hope this helps someone out.  More to come in the next few days on working with the Windows Azure REST API.