/// <summary> /// Stops the virtual machine instance /// </summary> public void Stop() { // start the role up -- this could take a while the previous two operations are fairly lightweight // and the provisioning doesn't occur until the role starts not when it is created var stopCommand = new StopVirtualMachineCommand(Properties) { SubscriptionId = Properties.SubscriptionId, Certificate = Properties.Certificate }; stopCommand.Execute(); }
/// <summary> /// Stops the virtual machine instance /// </summary> public void Stop() { Trace.WriteLine(String.Format("Stopping {0} virtual machines in deployment {1} in cloud service {2}", Properties.Count, Properties.First().DeploymentName, Properties.First().CloudServiceName)); foreach (LinuxVirtualMachineProperties linuxVirtualMachineProperties in Properties) { var stopCommand = new StopVirtualMachineCommand(linuxVirtualMachineProperties) { SubscriptionId = SubscriptionId, Certificate = ManagementCertificate }; stopCommand.Execute(); Trace.WriteLine(String.Format("VM stopped and deprovisioned with hostname {0}", linuxVirtualMachineProperties.HostName)); } }