/// <summary>
 /// The Get Device Configuration Script operation returns a script that
 /// you can use to configure local VPN devices to connect to the
 /// gateway.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/jj154115.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Network.IGatewayOperations.
 /// </param>
 /// <param name='networkName'>
 /// Required. The name of the virtual network for this gateway.
 /// </param>
 /// <param name='parameters'>
 /// Required. The parameters for the Get Device Configuration Script
 /// operation.
 /// </param>
 /// <returns>
 /// The configuration script returned from the get device configuration
 /// script operation.
 /// </returns>
 public static GatewayGetDeviceConfigurationScriptResponse GetDeviceConfigurationScript(this IGatewayOperations operations, string networkName, GatewayGetDeviceConfigurationScriptParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IGatewayOperations)s).GetDeviceConfigurationScriptAsync(networkName, parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
 /// <summary>
 /// The Get Device Configuration Script operation returns a script that
 /// you can use to configure local VPN devices to connect to the
 /// gateway.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/jj154115.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Network.IGatewayOperations.
 /// </param>
 /// <param name='networkName'>
 /// Required. The name of the virtual network for this gateway.
 /// </param>
 /// <param name='parameters'>
 /// Required. The parameters for the Get Device Configuration Script
 /// operation.
 /// </param>
 /// <returns>
 /// The configuration script returned from the get device configuration
 /// script operation.
 /// </returns>
 public static Task<GatewayGetDeviceConfigurationScriptResponse> GetDeviceConfigurationScriptAsync(this IGatewayOperations operations, string networkName, GatewayGetDeviceConfigurationScriptParameters parameters)
 {
     return operations.GetDeviceConfigurationScriptAsync(networkName, parameters, CancellationToken.None);
 }
 /// <summary>
 /// The Get Device Configuration Script operation returns a script that
 /// you can use to configure local VPN devices to connect to the
 /// gateway.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/jj154115.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Network.IGatewayOperations.
 /// </param>
 /// <param name='virtualNetworkName'>
 /// The name of the virtual network for this gateway.
 /// </param>
 /// <param name='parameters'>
 /// The parameters for the GetDeviceConfigurationScript request.
 /// </param>
 /// <returns>
 /// The configuration script returned from the get device configuration
 /// script request.
 /// </returns>
 public static GatewayGetDeviceConfigurationScriptResponse GetDeviceConfigurationScript(this IGatewayOperations operations, string virtualNetworkName, GatewayGetDeviceConfigurationScriptParameters parameters)
 {
     try
     {
         return operations.GetDeviceConfigurationScriptAsync(virtualNetworkName, parameters).Result;
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count > 1)
         {
             throw;
         }
         else
         {
             throw ex.InnerException;
         }
     }
 }