/// <summary>
        /// Deletes a Network Interface
        /// </summary>
        /// <param name="name">Name of the network interface</param>
        /// <param name="resourceGroup">Name of the resource group</param>
        /// <param name="deleteAll">true to remove all the resources associated with the network interface.</param>
        public async Task Del(string name, string resourceGroup, bool deleteAll = false)
        {
            INetworkInterface reference           = this.Get(name, resourceGroup);
            List <string>     virtualNetworkNames = new List <string>();
            var ipconfig = reference.IPConfigurations;

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

            azure.NetworkInterfaces.DeleteById(this.GetId(name, resourceGroup));

            if (deleteAll)
            {
                var virtualNetworks = new VirtualNetworks(this.credentials, this.subscriptionId);
                foreach (var n in virtualNetworkNames)
                {
                    await virtualNetworks.Del(n, resourceGroup);
                }
            }
        }
        /// <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);
                }
            }
        }