/// <summary> /// Converts the response from the service to a powershell database object /// </summary> /// <param name="resourceGroupName">The resource group the server is in</param> /// <param name="serverName">The name of the Azure Sql ServerActiveDirectoryAdministrator Server</param> /// <param name="admin">The service response</param> /// <returns>The converted model</returns> public static AzureSqlServerActiveDirectoryAdministratorModel CreateServerActiveDirectoryAdministratorModelFromResponse(string resourceGroup, string serverName, Management.Sql.Models.ServerAdministrator admin) { AzureSqlServerActiveDirectoryAdministratorModel model = new AzureSqlServerActiveDirectoryAdministratorModel(); model.ResourceGroupName = resourceGroup; model.ServerName = serverName; model.DisplayName = admin.Properties.Login; model.ObjectId = admin.Properties.Sid; return model; }
/// <summary> /// Creates or updates an Azure SQL Server Active Directory administrator. /// </summary> /// <param name="resourceGroup">The name of the resource group</param> /// <param name="serverName">The name of the Azure Sql ServerActiveDirectoryAdministrator Server</param> /// <param name="model">The input parameters for the create/update operation</param> /// <returns>The upserted Azure SQL Server Active Directory administrator</returns> internal AzureSqlServerActiveDirectoryAdministratorModel UpsertServerActiveDirectoryAdministrator(string resourceGroup, string serverName, AzureSqlServerActiveDirectoryAdministratorModel model) { var resp = Communicator.CreateOrUpdate(resourceGroup, serverName, Util.GenerateTracingId(), new ServerAdministratorCreateOrUpdateParameters() { Properties = GetActiveDirectoryInformation(model.DisplayName, model.ObjectId) }); return CreateServerActiveDirectoryAdministratorModelFromResponse(resourceGroup, serverName, resp); }