A major credit rating agency says Illinois' rating won't be lowered to "junk" but warns the state still faces serious financial challenges and long-term risks.

Moody's Investors Service on Thursday affirmed Illinois' current rating with a negative outlook, saying a downgrade remains possible in the next two years.

Moody's put Illinois under review for a downgrade earlier this month, after the state entered its third fiscal year without a budget. That would've made Illinois the first U.S. state to have a rating below investment grade, and cost taxpayers millions of dollars more.

Moody's says the budget legislators approved July 6 over Gov. Bruce Rauner's objections moved Illinois "closer to fiscal balance."

But the agency warns the budget doesn't reduce Illinois' unfunded pension liability, which is larger than any other state.