/// <summary>
 /// Creates a new Azure SQL Server Active Directory Administrator or
 /// updates an existing Azure SQL Server Active Directory
 /// Administrator.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.Sql.LegacySdk.IServerAdministratorOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the Resource Group to which the server
 /// belongs.
 /// </param>
 /// <param name='serverName'>
 /// Required. The name of the Azure SQL Server on which the Azure SQL
 /// Server Active Directory Administrator is hosted.
 /// </param>
 /// <param name='administratorName'>
 /// Required. The name of the Azure SQL Server Active Directory
 /// Administrator to be operated on (Updated or created).
 /// </param>
 /// <param name='parameters'>
 /// Required. The required parameters for creating or updating a Server
 /// Administrator.
 /// </param>
 /// <returns>
 /// Response for long running Azure SQL Server Active Directory
 /// Administrator operations.
 /// </returns>
 public static Task <ServerAdministratorCreateOrUpdateResponse> CreateOrUpdateAsync(this IServerAdministratorOperations operations, string resourceGroupName, string serverName, string administratorName, ServerAdministratorCreateOrUpdateParameters parameters)
 {
     return(operations.CreateOrUpdateAsync(resourceGroupName, serverName, administratorName, parameters, CancellationToken.None));
 }
 /// <summary>
 /// Begins creating a new Azure SQL Server Active Directory
 /// Administrator or updating an existing Azure SQL Server Active
 /// Directory Administrator. To determine the status of the operation
 /// call GetServerAdministratorOperationStatus.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.Sql.LegacySdk.IServerAdministratorOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the Resource Group to which the server
 /// belongs.
 /// </param>
 /// <param name='serverName'>
 /// Required. The name of the Azure SQL Server to which the Azure SQL
 /// Server Active Directory administrator belongs
 /// </param>
 /// <param name='administratorName'>
 /// Required. The name of the Azure SQL Server Active Directory
 /// Administrator.
 /// </param>
 /// <param name='parameters'>
 /// Required. The required parameters for createing or updating an
 /// Active Directory Administrator.
 /// </param>
 /// <returns>
 /// Response for long running Azure SQL Server Active Directory
 /// Administrator operations.
 /// </returns>
 public static ServerAdministratorCreateOrUpdateResponse BeginCreateOrUpdate(this IServerAdministratorOperations operations, string resourceGroupName, string serverName, string administratorName, ServerAdministratorCreateOrUpdateParameters parameters)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IServerAdministratorOperations)s).BeginCreateOrUpdateAsync(resourceGroupName, serverName, administratorName, parameters);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 /// <summary>
 /// Creates or updates a Azure SQL Server Active Directory Administrator
 /// </summary>
 public Management.Sql.LegacySdk.Models.ServerAdministrator CreateOrUpdate(string resourceGroupName, string serverName, ServerAdministratorCreateOrUpdateParameters parameters)
 {
     // Always set the type to active directory
     parameters.Properties.AdministratorType = ActiveDirectoryDefaultType;
     return(GetCurrentSqlClient().ServerAdministrators.CreateOrUpdate(resourceGroupName, serverName, ActiveDirectoryDefaultName, parameters).ServerAdministrator);
 }