A market correction is an excellent opportunity to focus on portfolio management. With many stocks well off previous highs, it's time to get into the nitty-gritty. Portfolio balancing and capital allocation are crucial to managing risk and meeting long-term goals. 

Many investors who own Amazon (AMZN 0.09%) and Microsoft (MSFT 0.53%) stocks may be considering rebalancing their allocations in each, as both stocks are down more than 20% from recent highs. At the same time, new investors may be trying to choose whether to buy one or both and how to allocate funds between them. Let's dive into some key metrics and determine which tech stock is the best option for your portfolio.

The battle for cloud supremacy

Amazon Web Services (AWS) is the world's leading cloud platform. Holding 33% of the market, it comes in significantly above second-place Microsoft Azure's market share of 21%. 

Cloud market share leaders

The cloud infrastructure market is vital for both companies, but perhaps more so for Amazon. AWS is so successful that it currently provides all of the company's operating profits (more on this in a minute). Sales have grown like a weed over the last several years. AWS has risen from $17.5 billion in revenue in 2017 to over $62.2 billion in 2021.

Amazon's cloud segment posted incredible results again in the first quarter of 2022. The $18.4 billion in Q1 sales represented 57% growth over the $13.5 billion earned in Q1 last year. AWS also dropped the mic by raising its operating margin to 35%, as shown in the chart below.

Amazon Web Services selected results

Data source: Amazon. Chart by author.

Few, if any, companies come close to these results, but Microsoft is no slouch. Microsoft reported Azure and other cloud services sales growth of 46% in its last report. In total, its intelligent cloud revenue reached $19.1 billion with a terrific 43% operating margin. 

Both companies are taking advantage of the massive growth in cloud computing, and Microsoft is making great strides in the space, but ultimately, Amazon is still the company to beat.

Advantage: Amazon.

Is Amazon or Microsoft more profitable?

Putting the cloud business aside, Amazon is struggling to make consistent profits. The pandemic was a momentary boon for the company as more people were ordering online. However, the labor market and logistical problems that followed effectively erased these bottom-line gains. Amazon's non-AWS segments have posted combined operating losses for the last three quarters -- with each steeper than the last. These segments (North America and International) lost a combined $2.8 billion from operations last quarter, despite posting over $98 billion in sales. 

Compounding Amazon's woes, companies like Walmart (WMT 0.07%) and Target (TGT -1.10%) are hedging deeper into online sales. The hunter has suddenly become the hunted. 

Because of this, the company's total operating margin was a paltry 3.2% last quarter.

Meanwhile, Microsoft is firing on all cylinders. It hit another sales record last quarter, reaching $49.4 billion on 18% growth. The capper was its 41% operating margin. One wouldn't expect a retail business to have margins like a pure tech company; however, Amazon's struggles are still telling. It has fallen behind other retailer competitors.

Advantage: Microsoft.

AMZN Operating Margin (Quarterly) Chart

AMZN Operating Margin (Quarterly) data by YCharts

Generating cash flow

Microsoft's consistent profits make for a boatload of operating cash flow, some of which is returned to shareholders through its growing dividend and share buyback program. In the last quarter alone, Microsoft produced $25.4 billion in cash from operations, paid $4.7 billion in dividends, and bought back $8.8 billion in stock. The current dividend yield is around 1%, and the payout has grown for the last 18 years. A rising dividend and solid buyback program like Microsoft's provides long-term investors support that is especially important in a down market. If the stock price falls, management can take more shares off the table with buybacks, and investors can count on the quarterly dividend checks. 

Amazon, though, has never paid a dividend and likely won't be considering one for some time. Free cash flow has been a sore spot recently with the added expenses related to labor and logistics. In its last report, Amazon reported a trialing-12-month free cash outflow of $18.6 billion and a 41% decrease in cash from operations over the same period. Now, the company must contend with rising fuel and other costs that could further exacerbate its cash flow challenges.

Another advantage of Microsoft's lucrative cash flow is the ability to make blockbuster acquisitions, like the recent $69 billion addition of Activision Blizzard. If approved, this will make Microsoft the third-largest gaming company in the world by sales and give it a larger foothold in another growing industry. 

Advantage: Microsoft.

Which company warrants the larger investment?

It is challenging to value Amazon by traditional metrics right now because of its recent struggles and diversified business model. Its forward price-to-earnings (P/E) ratio is well over 100, but this doesn't tell the whole story. Amazon's headwinds are strong, but they won't last forever. Meanwhile, AWS is highly coveted by investors and continues to dominate the cloud computing landscape. Management must guide the ship smartly through the current economy.

Microsoft's P/E is lower than it has been since the March 2020 crash (and before that early 2019), as investors worry about a potential recession. Microsoft has weathered economic slowdowns in the past and is carrying plenty of momentum into this one. The company is wonderfully profitable and producing gobs of cash, much of which is returned to shareholders.

Each company faces challenges, but Amazon's difficulties appear much more significant. Inflation has proven more persistent than many feared, and consumer spending is a concern. All of this suggests that Microsoft is the more compelling investment right now.