Elastacloud.AzureManagement.Fluent.Clients.WindowsVirtualMachineClient.CleanupUnattachedDisks C# (CSharp) Method

CleanupUnattachedDisks() public method

Cleans up any disks which don't have an attached VM
public CleanupUnattachedDisks ( ) : void
return void
        public void CleanupUnattachedDisks()
        {
            // get all of the disks in the subscription
            var command = new GetVirtualDisksCommand()
            {
                SubscriptionId = SubscriptionId,
                Certificate = ManagementCertificate
            };
            command.Execute();
            var disks = command.Disks;
            // initiate the blob delete

            // iterate through the disks and clean up the unattached ones
            foreach (var disk in disks)
            {
                // get the blob details
                //string storageAccount = ParseBlobDetails(disk.MediaLink);
                //IBlobClient blobClient = new BlobClient(SubscriptionId, StorageContainerName, storageAccount, ManagementCertificate);
                DeleteNamedVirtualMachineDisk(disk.Name);
                // delete the underlying blob
                //blobClient.DeleteBlob(disk.Name);
            }
        }