Addition of acidified silver nitrate tests for halide ions so can identify the anion for a few solutions there. Chloride produces white ppt (AgCl) which dissolves in dilute ammonia and bromide produces a cream ppt (AgBr) which dissolves in concentrated ammonia.
To distinguish between them Barium reacts with sulfuric acid to produce a white ppt as Barium Sulfate is very insoluble, Magnesium reacts with NaOH to produce a white ppt as Magnesium Hydroxide is very insoluble and ammonium can be heated with NaOH to produce fumes that turn damp red litmus paper blue.
To distinguish between the remaining Magnesium sulfate, sodium hydroxide and Sodium Carbonate, we can test for sulfates. Add Acidified Barium Chloride to the solution and a white ppt should be produced if a sulfate is present. Them to test for Sodium hydroxide you could test pH, as hydroxide ions turn red litmus paper blue. If needed sodium Carbonate reacted with acid produces carbon dioxide, which turns lime water cloudy.