Easy way? Make. Make a new account that allows legacy connections, disable MFA for it, and only turn it on before the script is ran, and then turn it off after...
It's a workaround, but likely easier than updating all your scripts to use azure app keys