Deductions & credits

Do I have to use my entire gain on a purchase in my new area? 


Example: Made $90k on a house in a year, single, and moving for a job from UT to AZ. Do I have to spend the $90k on a house in AZ or can I just move there and rent and still avoid C.G.?

 

If I do have to spend all $90k to avoid capital gains can I use some of that for repairs/upgrades or does it all have to be for the down payment?

 

Thanks in advance!