Azure growth for the quarter came in at 62%, decelerating from 76% a year ago but beating an estimate from Goldman Sachs analysts, who predicted growth of 58%, and accelerating from the prior quarter. Microsoft doesn't disclose Azure revenue in dollars.

Microsoft shares have been on a steady rise, jumping 63% in the past year, propelled by growth in the company's Azure public cloud business and Office 365 productivity suite. Ahead of the second-quarter earnings report, analysts called for continuing strength at Azure, which trails Amazon Web Services in cloud infrastructure, even though growth has been slowing.

On a year-over-year basis Microsoft's revenue rose 14% in the quarter, which ended on Dec. 31, according to a statement .

Microsoft stock moved 4% higher in extended trading on Wednesday after the company announced stronger-than-expected fiscal second-quarter results and revenue guidance for the next quarter.

"Our partner conversations this quarter continued to emphasize Azure's momentum, which is enabling the company to significantly outpace the overall market's growth," Goldman Sachs analysts led by Heather Bellini wrote in a Monday note. "Partners commented this quarter that they have seen Azure investments continue to increase significantly, as well an effective enterprise sales force focused on driving Azure adoption and usage."

The most high-profile win for Azure in the quarter came from the U.S. Department of Defense, which awarded the controversial Joint Enterprise Defense Infrastructure (JEDI) cloud contract to Microsoft, worth up to $10 billion over a decade. Additionally, rival Salesforce said it would tap Azure to run its Marketing Cloud service.

Microsoft included a new risk factor about government work in its latest quarterly earnings statement. "We may be subject to government audits and investigations relating to these contracts, we could be suspended or debarred as a governmental contractor, we could incur civil and criminal fines and penalties, and under certain circumstances contracts may be rescinded," the company said. It did not mention JEDI by name in the risk factor, despite that Amazon is currently challenging the contract award in court.

The Intelligent Cloud segment, which holds Azure, GitHub, server products like SQL Server and Windows Server and enterprise services, had $11.87 billion in revenue, up about 27% and more than the $11.40 billion consensus.

Microsoft's biggest segment, More Personal Computing, containing Windows, Surface, Xbox and Bing, contributed $13.21 billion in revenue, up 1.6% year over year and above the $12.85 billion consensus among analysts surveyed by FactSet. Revenue from Xbox hardware decreased 43% in the quarter because of lower prices and volumes; the next-generation Xbox Series X will come out this holiday season.

The Productivity and Business Processes segment, including Office, LinkedIn and Dynamics, put up $11.83 billion in revenue, up 17% and higher than the FactSet analyst consensus of $11.42 billion.

Industry analysis firm IDC said this month that fourth-quarter PC shipments grew 4.8% year over year to 71.8 million, leading to the first full year of growth since 2011. Last year IDC said that businesses were upgrading to Windows 10 before the end of support for Windows 7 this month.

Microsoft also stopped supporting the Windows Server 2008 operating system in mid-January, six months after it ended support of the SQL Server 2008 database software. Piper Sandler analysts led by Brent Bracelin, who have the equivalent of a buy rating on Microsoft stock, wrote in a note last week that those actions could "turn into potential growth headwinds this year."

End of support for Windows Server 2008 contributed to the Intelligent Cloud growth, Microsoft said on Wednesday.

The OEM Pro category, representing revenue from Windows licenses for commercial PCs, grew 26%, up from 19% one quarter earlier and the fastest growth at least since 2014, as companies kept moving to Windows 10. Microsoft's OEM non-Pro revenue, from Windows licenses for non-commercial PCs, increased 4%, the fastest growth since 2016.

Other significant developments in the quarter included the unveiling of new Surface devices and the announced acquisition of data migration start-up Mover.

With respect to guidance, Amy Hood, Microsoft's finance chief, told analysts Microsoft expects $34.1 billion to $34.9 billion in fiscal third-quarter revenue. The middle of the range, $34.5 billion, implies about 13% annualized growth and exceeds the $34.14 billion consensus among analysts polled by Refinitiv. She said her revenue guidance range for the More Personal Computing segment, at $10.75 billion to $11.15 billion, was wider than usual because of "uncertainty related to the public health situation in China."

Hood also said she now thinks that for the full 2020 fiscal year, which ends on June 30, Microsoft will increase its operating margin by 2 percentage points, suggesting about 36%, thanks to the company's results in the first half and the product sales mix in the second half. In July she had told analysts to expect a "stable" operating margin for the fiscal year ahead.

Follow @CNBCtech on Twitter for the latest tech industry news.