/// <summary>
 /// Updates the auto-execute status for this Advisor.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.Sql.IElasticPoolAdvisorOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the Resource Group to which the Azure SQL
 /// Server belongs.
 /// </param>
 /// <param name='serverName'>
 /// Required. The name of the Azure SQL Server on which the database is
 /// hosted.
 /// </param>
 /// <param name='elasticPoolName'>
 /// Required. The name of the Azure SQL Elastic Database Pool.
 /// </param>
 /// <param name='advisorName'>
 /// Required. The name of the Azure SQL Elastic Database Pool advisor.
 /// </param>
 /// <param name='parameters'>
 /// Required. The required parameters for updating auto-execute status
 /// of an Advisor
 /// </param>
 /// <returns>
 /// Represents the response to a update advisor request.
 /// </returns>
 public static AdvisorUpdateResponse Update(this IElasticPoolAdvisorOperations operations, string resourceGroupName, string serverName, string elasticPoolName, string advisorName, AdvisorUpdateParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IElasticPoolAdvisorOperations)s).UpdateAsync(resourceGroupName, serverName, elasticPoolName, advisorName, parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
 /// <summary>
 /// Updates the auto-execute status for this Advisor.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.Sql.IElasticPoolAdvisorOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the Resource Group to which the Azure SQL
 /// Server belongs.
 /// </param>
 /// <param name='serverName'>
 /// Required. The name of the Azure SQL Server on which the database is
 /// hosted.
 /// </param>
 /// <param name='elasticPoolName'>
 /// Required. The name of the Azure SQL Elastic Database Pool.
 /// </param>
 /// <param name='advisorName'>
 /// Required. The name of the Azure SQL Elastic Database Pool advisor.
 /// </param>
 /// <param name='parameters'>
 /// Required. The required parameters for updating auto-execute status
 /// of an Advisor
 /// </param>
 /// <returns>
 /// Represents the response to a update advisor request.
 /// </returns>
 public static Task<AdvisorUpdateResponse> UpdateAsync(this IElasticPoolAdvisorOperations operations, string resourceGroupName, string serverName, string elasticPoolName, string advisorName, AdvisorUpdateParameters parameters)
 {
     return operations.UpdateAsync(resourceGroupName, serverName, elasticPoolName, advisorName, parameters, CancellationToken.None);
 }
        public void UpdateStatusOfServerAdvisor()
        {
            using (UndoContext context = UndoContext.Current)
            {
                context.Start();
                var handler = new BasicDelegatingHandler();
                var sqlClient = Sql2ScenarioHelper.GetSqlClient(handler);
                AdvisorUpdateParameters updateParameters = new AdvisorUpdateParameters()
                {
                    Properties = new AdvisorUpdateProperties()
                    {
                        AutoExecuteStatus = "Disabled"
                    }
                };

                var response = sqlClient.ServerAdvisors.Update(ResourceGroupName, ServerName, AdvisorName, updateParameters);
                ValidateSingleAdvisor(response.Advisor, ServerAdvisorType, expectedAutoExecuteStatus: "Disabled");
            }
        }