Residency is conditional the first 2 years of marriage. Both spouses need to go through interviews, appear they are a couple - have joint bank accounts, bills, live together, etc.
It's also not a given that somebody with no existing legal status will be granted residency even if legitimately married.