/// <summary>
        /// Deletes virtual machine.
        /// </summary>
        /// <param name="name">Name of the virtual machine</param>
        /// <param name="resourceGroup">Name of the resource group.</param>
        /// <param name="deleteAll">true to remove all the resources associated with the virtual machine.</param>
        /// <returns></returns>
        public async Task Del(string name, string resourceGroup, bool deleteAll = false)
        {
            IVirtualMachine vmInstance = this.Get(name, resourceGroup);

            string        osDiskId            = vmInstance.OSDiskId;
            string        priNetworkInterface = vmInstance.GetPrimaryNetworkInterface().Id;
            string        publicIPAddress     = vmInstance.GetPrimaryPublicIPAddressId();
            List <string> virtualNetworkNames = new List <string>();

            var networkInterface          = new NetworkInterfaces(this.credentials, this.subscriptionId);
            INetworkInterface nwInterface = networkInterface.Get(priNetworkInterface);
            var ipConfigs = nwInterface.IPConfigurations;

            foreach (var k in ipConfigs.Keys)
            {
                virtualNetworkNames.Add(ipConfigs[k].GetNetwork().Name);
            }

            azure.VirtualMachines.DeleteById(this.getId(name, resourceGroup));

            if (deleteAll)
            {
                Disks disks = new Disks(this.credentials, this.subscriptionId);
                disks.Del(osDiskId);

                var oNetworkInterface = new NetworkInterfaces(this.credentials, this.subscriptionId);
                oNetworkInterface.Del(priNetworkInterface);

                var oPublicIPAddress = new PublicIPAddresses(this.credentials, this.subscriptionId);
                oPublicIPAddress.Del(publicIPAddress);

                var virtualNetworks = new VirtualNetworks(this.credentials, this.subscriptionId);

                foreach (var n in virtualNetworkNames)
                {
                    await virtualNetworks.Del(n, resourceGroup);
                }
            }
        }