He became captain of Pakistan's ODI side after the 2015 World Cup but was replaced by Sarfraz Ahmed at the start of 2017 after a string of poor results.
"I haven't taken this decision suddenly. I have been thinking about it," Azhar told reporters in Lahore. "It's the right time to focus on tests. There have been terrific players in one-dayers in the Pakistan set-up.
"I want to concentrate on tests with the same fitness and energy that I have been. I didn't decide to retire after any hard feelings. It's my personal decision."
(Reporting by Simon Jennings in Bengaluru; Editing by Hugh Lawson)
