Microstructure, resistivity and the anisotropy of the upper critical field in NbN thin films