It is shown that the presence or absence of perturbative gauge anomalies in renormalizable Yang-Mills theories, such as the Standard Model, can be determined at the one-loop level, a statement usually called "Adler-Bardeen theorem". The proof proceeds by relating gauge anomalies to background independence, which can be formalized by the concept of perturbative agreement. Before sketching the proof, I will provide an introduction to the framework of locally covariant quantum field theory and the definition and cohomological classification of gauge anomalies in that context.