# Why don't we use Ampere's law to find the magnetic field due to a wire of finite length?

So, when the current carrying wire is infinitely long, we apply Ampere's circuital law. But if the wire has a certain length, then we use Biot-Savart law. My question is, what is wrong with using Ampere's law?

$$\oint\vec B\cdot d\vec l=\mu_0I$$
In the case of an infinite wire, we can make arguments, based on symmetries of the problem, that for a circular loop centered on the wire, $\vec B$ is constant and parallel to $d\vec l$, and so this expression simplifies to:
$$2\pi rB=\mu_0I\rightarrow B={\mu_0I\over2\pi r}$$
which gives us the magnitude of the $B$-field everywhere, without having to do any non-trivial integrals.