The Diamondbacks announced the deal Saturday.
The 33-year-old Weeks spent his first 11 big league seasons in Milwaukee as a second baseman before playing outfield with Seattle last season.
Weeks struggled at the plate with the Mariners, hitting .167 in 37 games before being designated for assignment in June.
He was an All-Star with the Brewers in 2011, but has hit over .230 once since then.
Weeks is a career .247 hitter with 150 homers and 439 RBIs.