DeleteVirtualMachine() public méthode

Deletes the virtual machine that has context with the client
public DeleteVirtualMachine ( bool removeDisks = true, bool removeUnderlyingBlobs = true, bool removeCloudService = true, bool removeStorageAccount = true ) : void
removeDisks bool True if the underlying disks in blob storage should be removed
removeUnderlyingBlobs bool Whether or not remove the blob as well as the OS disk
removeCloudService bool Removes the cloud service container
removeStorageAccount bool The storage account that the vhd is in
Résultat void
        public void Execute()
        {
            var properties = new WindowsVirtualMachineProperties()
            {
                AdministratorPassword = _applicationFactory.Password,
                RoleName = _applicationFactory.RoleName,
                Certificate = _applicationFactory.ManagementCertificate,
                SubscriptionId = _applicationFactory.SubscriptionId,
                CloudServiceName = _applicationFactory.CloudServiceName,
                DeploymentName = _applicationFactory.DeploymentName
            };
            var client = new WindowsVirtualMachineClient(properties);
            var vm = client.VirtualMachine;
            client.DeleteVirtualMachine(true, true);

            System.Console.WriteLine("Deleted virtual machine + disks");
        }
        void IBuilder.TearDown()
        {
            var client = new WindowsVirtualMachineClient(_properties);
            string ipAddress = client.VirtualMachine.NetworkConfigurationSet.InputEndpoints[0].Vip;

            Console.WriteLine("The VIP is {0}", ipAddress);

            client.DeleteVirtualMachine();
            Console.WriteLine("Virtual machine has been deleted, with cloud service and storage");
        }