Photograph by Michael Clinard for Fortune

Microsoft Will Serve You Now

The newly customer-friendly tech giant is bulking up on data centers, betting its future on cloud computing, and learning to be agile again.

For a long time Miguel de Icaza and Nat Friedman were considered rebels by the technology establishment. De Icaza, an intense Mexican American with a square jawline and spitfire delivery, and Friedman, a Char­lottesville, Va., beanpole topped by a relaxed smile, were two of the golden boys of the open-source movement, a grass-roots campaign to let the source code of popular computer programs be free. In the 1990s, this approach was no less than heresy. Companies like Adobe adbe and Microsoft msft developed software by themselves, shrink-wrapped it, and shipped it to stores for sale. The notion of sharing one’s proprietary code with other software developers was akin to Coca-Cola ko releasing its fabled soda recipe to the public. Why would a sensible executive even consider such a thing?

But de Icaza and Friedman believed that technology companies were limiting the potential of software by developing it in isolation. The pair argued that popular programs like Microsoft’s Windows and Internet Explorer could be vastly improved by the collective intelligence of the developer community. After failing to persuade Microsoft to release its iron grip on its code in 1997—then, Friedman was a lowly intern, and de Icaza a mere job applicant—they set out to develop audacious software that spurned the company’s multibillion-dollar business model.

Today, Friedman, 38, and de Icaza, 43, are the chief executive and chief technology officer, respectively, of a San Francisco company called Xamarin. The co-founders started the firm in 2011 with a mission to improve software development for mobile devices, which were rapidly growing in popularity. Xamarin makes tools that allow developers to use a shared code base to create “native” applications for mobile operating systems made by Apple aapl , Google googl , and Microsoft. In other words, in a world of proprietary soft drinks, Xamarin is akin to a SodaStream.

Oh, and one more thing: It’s owned by Microsoft. The Redmond, Wash., giant acquired Xamarin for a reported $500 million in February. De Icaza and Friedman are now, paradoxically, Microsoft employees. And the company that once dismissed the open-source movement now owns a tool that makes apps for Apple and Google products.

No, this is not a utility site. It’s the outside of a Microsoft data center in central Washington State.Photograph by Michael Clinard for Fortune

“For us, this is incredible,” says Friedman, smiling broadly in a sunny conference room in Xamarin’s Telegraph Hill headquarters. “For a long time Microsoft was on the other side of open source. And now I would say, among the big tech companies, Microsoft is leading the charge. It’s a huge about-face.”

It most certainly is. For years the tech giant’s reputation preceded it. Microsoft was the Bill Gates– and Paul Allen–founded corporate colossus with such a stranglehold on the web browser that it drew a federal antitrust lawsuit. It was the out-of-touch PC maker that comedian John Hodgman lampooned in TV ads for Apple in the late 2000s as a hapless corporate stiff. It had a CEO, Steve Ballmer, known as much for his bull-in-a-china-shop demeanor as his business acumen. Critics derided the now 41-year-old company for its insular corporate attitude and glaring lack of cool. Employees lamented its wasted potential.

MIC.06.15.16.Microsoft Cloud.04 Photo: Courtesy of Microsoft

Investors weren’t happy either. When Ballmer replaced Gates as CEO in January 2000, Microsoft’s market capitalization was about $600 billion, making it the most valuable company in the world. When Ballmer announced in August 2013 that he would retire within a year’s time, Microsoft’s market cap had shrunk to just $270 billion.

After decades of software dominance—a reign unmatched in the history of the technology industry—Microsoft was viewed by many to be in permanent decline. The notion that the company could lead a new and growing software business in the 21st century was preposterous. Microsoft, critics argued, could barely put one foot in front of the other.

But a funny thing happened on Ballmer’s way out the door: Microsoft began to change. In 2013 it engaged in a dramatic reorganization of its core businesses, intended to strategically align disparate divisions by function and not product, under a plan Ballmer called “One Microsoft.” In 2014 the board named Ballmer’s long-awaited replacement: Satya Nadella, 48, a native of Hyderabad, India, and the head of the company’s newly formed cloud and enterprise engineering group.

MIC.06.15.16.rank

Since becoming CEO, Nadella has dramatically accelerated the transition begun under Ballmer. He has directed resources away from many of Microsoft’s declining legacy businesses and toward cloud computing, a fast-growing category ruled by rival Amazon but nascent enough (and vast enough) to potentially turn Microsoft’s fortunes. He has promoted senior executives who share his vision of a more collaborative and curious Microsoft and sent packing those who do not. And he has urged his newly empowered leaders to fly to Silicon Valley to absorb the entrepreneurial lessons that the company long chose to ignore.

Today at Microsoft there is excitement in the air—a sense that it is once again ascendant. The company’s shares, at a recent price of $52, are trading higher than they have in 16 years. Its rank, No. 25, on this year’s Fortune 500, is its loftiest ever. The world’s largest software company has set out to cure what ails it, and the effort finally appears to be working.

MIC.chart02

But Microsoft is also engaged in a high-wire act that carries considerable risk. It is still working through past missteps, such as its $7.2 billion acquisition of Nokia’s ailing phone business, and continues to lay off thousands of workers. Meanwhile the business on which Microsoft has chosen to gamble its fate, cloud computing, has proved viciously competitive and potentially cannibalistic to its legacy businesses that continue to generate so much cash, says Keith Weiss, a Morgan Stanley analyst who tracks major U.S. software companies. “You’re moving from high-margin businesses with a sticky customer base to a lower-margin business with big competitors and less sticky customers,” he says. “You’re not just competing with Amazon and Google but opening up your ‘closed garden,’ if you will. Your customers were once Microsoft shops; now you’re creating an open platform where they don’t have to use your services.”

Still, the cloud represents a chance for Microsoft to make up for a lot of missed opportunities. “For the first time in probably 10 years, there’s a key secular trend on which Microsoft is at the very forefront,” Weiss says. “They missed search, the browser, mobile. The public cloud is one they got in front of, and it’s a big one that could be bigger than all the other ones combined.”

To ensure that it doesn’t lose out this time, Microsoft is undergoing a radical and rapid transformation. The former schoolyard bully of the software world is remaking itself as a collaborative, customer-friendly service provider. The real question is, Can the tech giant change fast enough to capitalize on its next great growth engine before its legacy businesses pull it under?

The Forensics Lab inside Microsoft’s new cybercrime center on its campus in Redmond, Wash. by fighting online criminals, the company hopes to make the cloud safer for its customers.Photograph by Michael Clinard for Fortune

One of Nadella’s first decisions as CEO was choosing who would replace him as the leader of “C&E,” as employees call it, the $25 billion unit responsible for the back-end technologies on which Microsoft and its corporate customers rely. This was no small matter. Microsoft’s massive consumer hardware and software businesses are largely stagnant or in decline. The company sees its enterprise portfolio, and particularly its cloud-­computing efforts, as the connective tissue that will link the rest of the company’s products and services.

“There won’t be any one device that controls us,” Nadella says of the future of technology, when I ask him what role the cloud plays in the company’s overall strategy. “We’re going to have more and more computing—things on our wrists, things on our eyes, things in our pockets, big screens, small screens, sensors. We want intelligent experiences for any computing that we use. That is only possible because the cloud orchestrates that mobility.”

In March 2014, Nadella appointed Scott Guthrie to lead C&E. A 17-year veteran of the company, Guthrie, 41, ran the Azure cloud business, which was posting triple-digit quarterly growth. In his earlier days at Microsoft, Guthrie helped create ASP.NET, a framework that allows developers to ­produce dynamic web applications and services. He is a well-known advocate of open-source software.

MIC.06.15.16.Microsoft Cloud 05.png Photo: Courtesy of Microsoft

I first meet Guthrie in late March at a wood-paneled sports bar across the street from San Francisco’s Moscone Center. There, Microsoft is holding Build, its annual software developers conference. Guthrie is there to greet and eat with what the company calls its “regional directors”—­independent professionals who support the company’s products (or, in tech industry parlance, “evangelists”). Guthrie is wearing his signature red polo shirt, an Everyman alternative to Steve Jobs’ black mock turtleneck. Like the business he runs, Guthrie is a quiet giant. He is lanky and unfailingly polite. He speaks in a soft baritone and largely shuns corporate bromides—“best in breed,” “paradigm,” “leverage”—that executives often find hard to resist.

Here, among these longtime Microsoft enthusiasts, Guthrie is a rock star—a fellow nerd made good. He stands up to address the group, shoving one hand in his pocket almost bashfully. As Guthrie describes Microsoft’s enormous investments in data-center capacity—$15 billion since 1989—and teases its coming announcements, the attendees interrupt him to ask questions, make quips, and lob criticisms. One manager doesn’t hesitate to remind him that Guthrie personally rewrote his code years ago. Another remarks on the faded hue of his shirt. “This one’s a few years old,” Guthrie replies with a shrug.

The next day—this time in a brand-new red polo—Guthrie delivers his 90-minute presentation to almost 5,000 software developers, partners, and press. An announcement about Xamarin serves as its climax: Barely 10 days after closing the acquisition, Microsoft would make the startup’s technology available for free within Visual Studio, its popular software development application. The room erupts in shouts and applause. On stage, Guthrie grins and basks in the roar.

Scott Guthrie, 41, in his trademark red polo. As the head of Microsoft’s $25 billion cloud and enterprise unit, the 17-year veteran is a key figure in the company’s renaissance.Photograph by Michael Clinard for Fortune

Afterward, I sit down with him backstage. Guthrie is hoarse, happy, and a little winded. The crowd’s reaction is a complete 180 from how people felt about Microsoft just five years ago, he says, when Nadella asked him to lead the Azure business. Guthrie spent a month visiting the company’s corporate customers and listening. He didn’t like what he heard. “A couple of things became obvious,” he says. “We hadn’t built something very customer-friendly. It was great technology. But it wasn’t solving customer problems.”

Guthrie’s solution? An off-site meeting to force his team to use Azure for themselves. “Basically the deal was, all the senior managers and architects had to bring their laptops, and we were going to build an app from scratch together for two days,” he says. The executives sat in a hotel ballroom and spent two days trying to sign up, build, and deploy Azure cloud applications as customers would. “It was a complete disaster,” says Guthrie.

Some managers couldn’t figure out how to sign up. Those who turned to support documentation discovered that it was out of date. Other features simply didn’t work. “By the end of the second day, we wrote down everything we needed to do to fix this—a backlog of 100 items—and had our plan,” Guthrie says. “We spent the next year completely rebuilding Azure. It was fun because people could see the progress. People could feel the energy.”

That excitement is something that I observed repeatedly in interviews with dozens of Microsoft employees past and present, its partners, its customers, and outside observers. There is a palpable sense that Microsoft is back to building great technology, not just pushing products on customers.

MIC.chart01

Judson Althoff, 43, an 11-year Oracle veteran who is now president of Microsoft North America, remembers some of his first sales trips after joining the company in 2013. “You’d go and see the customer in mid-America, the ‘show me’ states, and it could be pretty pointed,” he says. “They’d say, ‘Look, we just don’t think what you’re building today at Microsoft is the technology of the future. We’re using less and less of your IP, and you’re charging more and more for what we view as aging tech. It’s not what millennials want to come to work and use. It’s not where our big bets are as a company for pursuing digital transformation—the basic areas where we’re focused, either on driving top-line revenue or reducing bottom-line cost—we don’t see Microsoft enabling that.’ ”

That’s no longer the case. Zack Hicks, chief information officer of Toyota North America and CEO of Toyota Connected, the automaker’s new data services arm, says his relationship with Microsoft today is dramatically different than it was a few years ago. “Sometimes when we’re working with Silicon Valley startups—particularly when they’re well funded—the hubris and arrogance is difficult to get through,” he says. “With Microsoft, I’m finding a humble partner who wants to collaborate.”

I visit Microsoft’s lush and sprawling corporate campus in suburban Redmond just as the company reports its fiscal third-quarter results for 2016. The numbers aren’t pretty. Microsoft’s $20.5 billion in revenue is down more than $1 billion from the same period a year before, depressed by continued ­decline in its Windows consumer licensing business. And growth in the cloud business is slower than expected. The news sends Microsoft shares down 5% in after-hours trading.

MIC.chart03

But despite the gloomy report, the mood at Microsoft headquarters is buoyant. On this sunny spring day, many ­employees—sunglasses and Surface tablets in tow—have ditched their offices for the manicured lawns outside. Those still inside are scattered around colorful collaborative spaces, a product of a recent initiative to renovate many of the 120 or so 1980s-era buildings on campus. In the café areas in each building, paper coffee cups read:

10 we code, 20 we ship, 30 we learn, 40 GOTO 10

The code snippet is a quiet rejoinder to late Apple CEO Steve Jobs’ criticism that Microsoft “never had the humanities and liberal arts in its DNA.” “So what?” it seems to suggest. “We were more of a programmer’s company anyway.”

On a Wednesday morning I join senior executives in a conference room in Building 18 for what the company calls a “pillar” meeting—a weekly hour meant to serve as a deep dive into a focus area for the company. This week’s session concerns Microsoft’s enterprise mobility suite, the technologies that allow its corporate customers to use phones, tablets, and laptops outside their offices.

MIC.06.15.16.Microsoftsidebar

The meeting begins casually—so much so that 10 minutes pass before I realize it has actually begun. The 26 men and women in the room sit in silence with their heads bowed. Together, they leaf through a nine-page document packed with statistics and analysis. One executive wearing an Apple Watch rubs his forehead, lost in thought. Another cracks his knuckles. Twenty minutes pass before the first person asks a question, shattering the silence.

There aren’t many companies that begin meetings with a shared reading assignment. (One prominent exception: cross-town neighbor Amazon.) For a long time Microsoft didn’t either. But Joy Chik, 40, one of the execs in the room, says it’s a sign that the company is spending a lot more time trying to use data rather than seniority or force of personality to make decisions about product fixes or features. “In the past we’d march on for months or years before we’d admit defeat,” says Chik, an 18-year veteran who now runs the engineering team that builds Microsoft’s mobile device management technologies. “Now we say, ‘It’s not working out,’ and we pivot. But that’s hard. How do you learn fast and fail fast? How do you change the culture so that people aren’t penalized by that? We don’t encourage failure—it’s more about the learnings from the failure.”

COV.06.15.16.xmit Photograph by Michael Clinard

“Failure”—by embracing the word Microsoft employees appear to be less burdened by it than before. Today’s Microsoft is a much more inquisitive place. Its employees are proud of the company’s role in history and encouraged by an environment that’s less likely to thwart a promising idea. And though they are hesitant to fully attribute Microsoft’s transformation to Nadella—much of it happened slowly and organically over many years—they unanimously credit the CEO and his team with stepping on the gas.

“There are a lot of really smart people running around here,” says Kirk Koenigsbauer, 48, who’s been with the company for 15 years and now leads its Office 365 client applications product team. “But when people actually feel empowered? It’s amazing the creativity that ends up coming out. I really do think the company was ready for change in a really big way. Satya just unlocked the door.”

Now all Microsoft has to do is walk through it. The company has much work to do to prove to investors that it can move fast enough, and aggressively enough, to replace its titanic but languishing revenue streams. Microsoft must also convince employees in its consumer divisions, who are wary of the company’s full-throated embrace of enterprise technology, that it can still innovate in the products that made it a household name. And it must demonstrate how winning in the cloud positions it well to capitalize on the next waves of technology, be it machine learning, the so-called Internet of things, or something else entirely.

For now it is clear that Microsoft has redefined its original mission to put computing in front of every person. But in the wake of its lost decade, the company is beginning to find itself again. “This is not about saying, ‘Oh, we’ve gone through some cultural transformation and we’re done,’ ” Nadella says. “This has to be a constant thing. This is not a journey that will be complete. This is a journey that hopefully makes every one of us better.”

Friedman, the Xamarin CEO, looks at it a bit differently. There is a renaissance underway at Microsoft, he says, and it is helping the company to remember what made it so formidable in the first place. “Big companies are much more exciting places to be now than they were five or 10 years ago,” he says. “They’ve learned to be agile. They’ve learned to be innovative. They’ve learned to not take their customers for granted. In many ways, the best big companies have learned the tricks of the startups.”

Microsoft learned its lessons the hard way. To be great again, it had better not forget them.

A version of this article appears in the June 15, 2016 issue of Fortune with the headline “Microsoft Will Serve You.”

Sign In

Get

Thank you for your interest in licensing Fortune content. Please find information on various licensing contacts below and choose the one that best suits your needs:

  • 1. To license Fortune articles, excerpts, or headlines for republication in various media (including books, eBooks, film, web, newsletters, newspapers, magazines and others), please email syndication@timeinc.com.
  • 2. To license a Fortune cover, order reprint or e-print copies of an article or cover, or license an accolade, please contact PARS International at www.timeincreprints.com.
  • 3. To license text only photocopies of Fortunearticles as print or digital handouts in academic settings, or in academic coursepacks, please contact the Copyright Clearance Center at www.copyright.com