Catalysis of the reaction: 3'-phosphoadenosine 5'-phosphosulfate + heparan sulfate = adenosine 3',5'-bisphosphate + heparan sulfate 6-O-sulfate; results in 6-O-sulfation of glucosamine residues in heparan sulfate.