Wall Street doesn't seem to know what to think about Microsoft (MSFT -0.14%) stock in 2023. The software giant's shares trounced the S&P 500 through the early phases of the pandemic, but its outperformance has waned over the past year. Now, investors appear to be worried about slowing growth and the potential for weakening sales trends to spread into its cloud services business.

Short-term risks like those are always present with any potential stock purchase, but smart investors focus on a company's wider thesis. With that in mind, let's look at some factors that make Microsoft a compelling investment today.

The wide portfolio

Some key parts of Microsoft's empire are shrinking. PC shipments are slumping, for one, and executives are projecting further declines in the neighborhood of 30% that will bring them down to pre-pandemic levels. Microsoft is enduring a growth hangover in its gaming segment, too, as consumers resume their normal entertainment habits.

These pullbacks were a key reason why the company's sales growth slackened to just 2% last quarter after spending more than five years in the double-digit percentages.

MSFT Operating Revenue (Quarterly YoY Growth) Chart

MSFT Operating Revenue (Quarterly YoY Growth) data by YCharts.

But Microsoft's cloud segment is helping it navigate through this short-term weakness. The enterprise business expanded at a 20% rate through the first half of its fiscal 2023 (a period that ended Dec. 31, 2022), executives said in a conference call, and overall cloud services were up 29% after adjusting for foreign currency shifts. "We have a resilient foundation in durable growth markets where we are gaining share," CFO Amy Hood told investors in late January.

Cash and profits

The company's financial strength is still impressive. Microsoft generated more than $20 billion in profits this past quarter, translating into an operating margin of roughly 40% of sales. That result was far ahead of those of big tech peers such as Apple and Meta Platforms.

The outlooks for earnings and cash flow are bright, too, in part thanks to cost cuts and solid sales trends in cloud services. Success there is helping fund a steady stream of cash flow to shareholders. Microsoft delivered $9.7 billion to its investors last quarter, about evenly split between dividends and stock repurchases.

Value for the long term

The next few quarters are likely to be weaker for Microsoft than investors saw through most of the pandemic. Management noted more caution from enterprises starting in December, which suggests it could see slower commercial sales in the second half of its fiscal year.

But it is highly likely that over time, tech spending will rebound in both the consumer and enterprise markets. Microsoft's focus today is on continuing to gain market share in key areas like cloud services, cybersecurity, and workplace communications.

In the meantime, investors might consider picking up this stock, as it's trading at a relative discount. Shares are valued at about 9 times sales, down from nearly 15 times sales in late 2021. Sure, the selling environment has weakened a lot since then, and risks include a potential further slowdown for the global economy.

But Microsoft has the resources to navigate those conditions without sacrificing investments into growth areas like AI and cloud services. As a result, shareholders might look back in a few years and be glad that they held this software giant in their portfolios through the volatility of 2023.