Microsoft (MSFT 1.82%) missed on both revenue and earnings in its fiscal 2022 fourth quarter. That disappointing news, which the company delivered after the close Tuesday, seemed to confirm the negative segment that has weighed on the tech sector since late last year.

But Microsoft's stock rose 5% Wednesday, trading on a rosier outlook. The factors underlying that market reaction could make this a smart time for investors to consider adding some shares of Microsoft to their portfolios -- and perhaps some of its peers as well.

Microsoft earnings

It was a rare miss for the company. Microsoft's revenue increased by 12% to $51.9 billion in its fiscal fourth quarter, which ended June 30. Wall Street had expected $500 million more.

Notably, the strong dollar had a negative effect on its international revenues -- on a constant-currency basis, revenue growth was 16%. Likewise, net income rose only 2% to $16.7 billion, falling short of expectations by about 3%. A 17% rise in the cost of revenue and a 20% increase in research and development costs had dramatic impacts on net income.

However, in the guidance for fiscal 2023 that management provided during the earnings call, it forecast double-digit percentage growth in revenue and earnings in both constant currency and U.S. dollars.

The impact of earnings

That more positive outlook seemed to negate the impact of the earnings and revenue misses, explaining why the stock rose following the report.

The report and guidance also point to the continuing strength of non-consumer tech. Despite the overall sales weakness, Microsoft's Azure revenue increased by 40%, and intelligent cloud remained the company's largest and fastest-growing segment. Moreover, cloud services tend to be money-saving options for the companies that use them. Thus, even if the economy slides into a recession, the cloud segment is likely to cushion Microsoft from the impact of a consumer spending downturn.

Amid this bear market, Microsoft trades at a price-to-earnings ratio of 28 -- a near two-year low. While it is not the cheapest cloud stock, it is far undervalued relative to cloud rival Amazon, which trades for 57 times earnings.

Additionally, Microsoft's share price move Wednesday could point to positivity and an improving investor outlook for the tech sector in general. Market leaders tend to be the last to fall in downturns and the first to recover from them. That Microsoft gained ground despite the quarterly miss may indicate that the tech sector slide is close to bottoming out. This could offer hope for investors who have seen the Nasdaq Composite Index fall by more than 23% and numerous growth tech stocks drop by more than 80% amid a brutal year for the broader market.