Do I still have to pay rent that I owed to the landlord before I terminated my lease?
Most likely, yes. Even if you terminate your lease, you will still have to pay the landlord any unpaid rent or other money that you already owed him/her before the lease was terminated, including rent for the month that you will be living there after you give the 30 days notice of termination. This amount must be paid to the landlord on or before the date you vacate the home or apartment that you were renting.
You will not have to pay rent for the months that would have been left on the lease after you leave the apartment or house, assuming you properly followed all of the steps outlined in What steps must I take to terminate my lease early? (Note: If you already pre-paid rent that would apply for the month in which you terminate your lease, your landlord does not have to refund that money to you.)
Additionally, your landlord cannot keep your security deposit solely because you are terminating your lease early under this law. Your landlord, however, can keep this deposit for other reasons, such as if there is damage to the apartment, etc.1
1 A.R.S. § 33-1318(D)