public void DeleteNamedVirtualMachineDisk(string name)
{
bool diskErased = false;
int count = 0;
// keep this going until we delete the disk or time out!
while (count < 100 && !diskErased)
{
try
{
var deleteVirtualMachineDisk = new DeleteVirtualMachineDiskCommand(name)
{
SubscriptionId = Properties.SubscriptionId,
Certificate = Properties.Certificate
};
deleteVirtualMachineDisk.Execute();
diskErased = true;
}
catch (Exception)
{
count++;
Thread.Sleep(3000);
}
}
}