Despite declines in its core Windows business, Microsoft's (NASDAQ:MSFT) transformation into a cloud-computing behemoth appears to be going quite well. Demand for its cloud services has been particularly strong in recent quarters, and there's some hope that it could succeed in reviving its Windows platform.

Amid a string of solid earnings reports, Microsoft shares have risen to a 10-year high. At these levels, does it make sense to buy shares of the Windows maker?

A modest valuation
Microsoft is neither particularly expensive, nor is it particularly cheap. Its trailing-12-month price-to-earnings ratio is around 20, roughly in line with the broader S&P 500. It's more expensive than other megacap tech stocks, such as Apple and Oracle, but less expensive than Google.

One of the more attractive aspects of Microsoft is its dividend -- it currently yields about 2.50%. It should be able to pay that dividend for many years to come as, like many of its peers, Microsoft is sitting on a large cash pile. About $95 billion, roughly one-quarter of Microsoft's market cap, is in cash.

An ongoing transformation
A market multiple may be fitting for Microsoft, given its size and relatively established business segments. But within Microsoft, there are varying degrees of growth taking place.

Demand for Microsoft's cloud services has been off the charts. Last quarter, commercial cloud revenue rose 106% on an annual basis; in the prior quarter, it rose 114%. Microsoft has consistently cited the growth of Azure, Office 365, and Dynamics CRM to explain its booming commercial cloud business. Consumers have little use for Azure (Microsoft's cloud computing platform service) or Dynamics CRM (its sales force software), but they still need Office, and they're buying it. Last quarter, Microsoft reported that it now had 12.4 million consumers subscribing to Office 365, up 35% on a sequential basis.

Microsoft's legacy businesses, in particular Windows, are not performing as well. Windows-related revenue contracted 22% last quarter, and that comes after a 13% decline in the quarter before that.

If may be difficult, if not impossible, for Microsoft to reinvigorate its Windows business -- at least not directly. Increased competition from OS X, iOS, Android, and Chrome OS has taken a toll on Windows. All of those operating systems are given away for free, making them more attractive to consumers (in the case of iOS and OS X) or device makers (in the case of Android and Chrome OS). To stay relevant, Microsoft has had to discount Windows to keep the platform attractive, and beginning with Windows 10, Microsoft will offer some versions of Windows as a free download.

To make money from Windows, Microsoft will rely on complimentary services it can monetize, such as Bing and Xbox Live. But it's a new business model for Microsoft, and success is far from guaranteed.

Better 12 months ago
Microsoft doesn't appear to be as attractive of an investment as it was a year or two ago, when shares were cheaper both on a nominal and valuation basis.

But there's still a lot to like about Microsoft's business. The Windows platform remains challenged, but that's increasingly irrelevant, as Microsoft's cloud services continue to deliver. However, commercial cloud revenue is still a fraction of Microsoft's larger sales -- its annual run rate of $6.3 billion is roughly 8% of its total annual revenue.

If you're looking for a megacap tech stock for your portfolio, you could do worse than Microsoft. At the very least, it's likely to be a reliable cash generator for many years to come, and if its cloud business maintains its record growth, shares could keep moving higher. But if Microsoft's cloud growth slows, or the creeping irrelevancy of the Windows platform begins to take a toll on its financials, shares could head lower.