/// <summary> /// The Start Role operation starts the specified virtual machine. /// (see http://msdn.microsoft.com/en-us/library/windowsazure/jj157189.aspx /// for more information) /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Compute.IVirtualMachineOperations. /// </param> /// <param name='serviceName'> /// The name of your service. /// </param> /// <param name='deploymentName'> /// The name of your deployment. /// </param> /// <param name='virtualMachineName'> /// The name of the virtual machine to start. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public static OperationResponse BeginStarting(this IVirtualMachineOperations operations, string serviceName, string deploymentName, string virtualMachineName) { try { return operations.BeginStartingAsync(serviceName, deploymentName, virtualMachineName).Result; } catch (AggregateException ex) { if (ex.InnerExceptions.Count > 1) { throw; } else { throw ex.InnerException; } } }
/// <summary> /// The Start Role operation starts the specified virtual machine. /// (see http://msdn.microsoft.com/en-us/library/windowsazure/jj157189.aspx /// for more information) /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Compute.IVirtualMachineOperations. /// </param> /// <param name='serviceName'> /// The name of your service. /// </param> /// <param name='deploymentName'> /// The name of your deployment. /// </param> /// <param name='virtualMachineName'> /// The name of the virtual machine to start. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public static Task<OperationResponse> BeginStartingAsync(this IVirtualMachineOperations operations, string serviceName, string deploymentName, string virtualMachineName) { return operations.BeginStartingAsync(serviceName, deploymentName, virtualMachineName, CancellationToken.None); }
/// <summary> /// The operation to start a virtual machine. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.Azure.Management.Compute.IVirtualMachineOperations. /// </param> /// <param name='resourceGroupName'> /// Required. The name of the resource group. /// </param> /// <param name='vmName'> /// Required. The name of the virtual machine. /// </param> /// <returns> /// The compute long running operation response. /// </returns> public static Task<ComputeOperationResponse> BeginStartingAsync(this IVirtualMachineOperations operations, string resourceGroupName, string vmName) { return operations.BeginStartingAsync(resourceGroupName, vmName, CancellationToken.None); }