Ballmer left a company that was a mess. He was boosting profits through repeated layoffs and price squeezing. It had just bought my former employer (Nokia's phone business) without a clear strategy. Windows Phone was already failing in the market due to a series of strategic blunders, arrogance, and poor product positioning and platform strategy. Windows 7 and 8 had largely flopped in the market with lackluster adoption for the same reason. The cloud business was heavily windows focused and not an easy sell either: same reason. Meanwhile developers were jumping ship in favor of Apple laptops and Linux servers, android/ios phones, and standards based web applications on top of Chrome and Firefox.
I grew up in the nineties; things were different then. Visual Studio was the go to product for many developers and developing on windows was a given. Macs didn't become useful as developer machines until a decade later and Linux was a something you ran in your closet or on a old hand me down PC (been there done that). That changed under Ballmer's rule and he failed to adapt. He alienated developers and failed to move windows forward; all while bashing Linux and the Open source community in futile attempts to stem the bleeding of mindshare, revenue, and share holder value.
Fast forward five years or so since Nadella took over and the stock has responded positively to post Ballmer changes by Nadella to bring MS into this century after what was a lost decade.
MS now does open source and established itself as a credible player in the OSS community, it killed off windows phone, opened up the lucrative office ecosystem to non windows platforms by e.g. treating Android and IOS as first class citizens and supporting things like Chrome OS. By embracing linux and open source, and by turning Azure into a very competitive product that mostly runs Linux. He just took Edge out the back and shot it as well.
The net result of all this is that he re-established MS as a company that appeals to developers because despite his famous Mantra, developers were running away under Ballmer. VS Code, having SQL Server supported on linux, supporting Linux and contributing to it, embracing the wider C# ecosystem outside of the Windows silo, buying Github, etc. are all clever moves that rebuilt lost trust. All these things were unthinkable under Ballmer. Even Windows 10 is starting to look pretty nice to people like me with it's linux subsystem, Docker support, and nice hardware options.
As a consequence they have a lot of healthy growth in their cloud business because developers take them serious again. Shareholders are liking this and their prospects for more growth through a portfolio that is no longer just wintel laptop based revenue.