After the dismal performance last year, the stock market has been doing quite well in 2023. Wall Street has been quite unpredictable, with the past recession worries now replaced by euphoria around everything artificial intelligence (AI).

The benchmark S&P 500 index is up by 15% so far this year. With the index currently around 23% over its October 2022 low, many analysts now believe this might be the early stage of a bull market.

Whether this is a definitive bull market or not -- only time shall tell. However, investors who want to build long-term wealth can strengthen their portfolios by picking up small positions in incredible stocks that can rally in a bull market and are resilient to a bear market. Here's why Microsoft (MSFT 1.82%) and CrowdStrike (CRWD 2.03%) fit the bill.

1. Microsoft

The technology giant Microsoft easily surpassed revenue and earnings consensus estimates in the fourth quarter (ending June 30, 2023). Despite the solid results, the company's outlook seems to have disappointed investors. And if you're watching the stock market, while Microsoft's shares are down by nearly 8% since its fourth-quarter earnings release, they are still up by 35% so far this year -- and can start going higher in the coming months.

A major player in the ongoing AI revolution, Microsoft's $13 billion investment in ChatGPT developer OpenAI has played a pivotal role in supercharging its offerings, like Bing, Azure, and Microsoft 365, making them more efficient and cost-effective.

Thanks to its extensive penetration in enterprise software (in areas such as productivity, cloud computing infrastructure, and cybersecurity), the company is in an advantageous position to upsell its generative AI offerings. The company plans to monetize Microsoft 365 Copilot, an AI assistant for the Microsoft 365 productivity suite, at $30 per month -- a huge revenue opportunity, considering over 345 million people (paid seats) are using the Microsoft 365 suite.

In 2023, Microsoft's Azure cloud business alone contributed nearly $55 billion of the $110 billion in total cloud revenues. Cloud computing is still a major growth opportunity for Microsoft; even in 2023, 90% to 95% of global IT spend is for on-premise infrastructure. As enterprises opt for improved productivity and optimal resource utilization, migration to the cloud will continue in the coming years.

According to Evercore ISI analyst Mark Mahaney, cloud computing also stands to benefit dramatically from the huge surge in demand for computational power and data storage required for generative AI workloads.

Cybersecurity has also emerged as a new frontier for Microsoft -- and with Security Copilot (next-generation AI into security operations), the company will be well positioned to rapidly capture share in this growing market. With such robust tailwinds, if you're thinking of investing in Microsoft, the future looks quite promising.

2. CrowdStrike

Shares of cybersecurity stalwart CrowdStrike are already up by 36% so far this year, yet are still more than 50% below their all-time high. The company's price-to-sales (P/S) ratio of 13.8 is also at historically low levels. Certainly, there is still a good possibility for the stock to go higher in the coming months.

For the past decade, cybersecurity stalwart CrowdStrike has been leveraging AI and machine learning to detect, respond to, and eliminate cyber threats. The increasing prevalence of connected devices and the rising adoption of hybrid work arrangements have made endpoints (devices such as tablets, smartphones, and laptops) easy targets for hackers.

These are a few of the trends driving up the rapid expansion of the endpoint security market -- estimated to balloon from $13.4 billion in 2023 to $29.7 billion in 2027. A leader in endpoint detection and response security space with a 17.7% share, CrowdStrike stands to benefit dramatically from this tailwind.

CrowdStrike also offers other security services, such as identity protection, observability, and workload protection, through its cloud-native AI-driven multi-modular Falcon platform.

CrowdStrike has built a solid customer base of over 23,019 (at the end of fiscal 2023). The broad customer base and portfolio of diverse security offerings enable the company to upsell and cross-sell its offerings effectively. The company also benefits from the network effect since data on innovative types of cyber threats (trillions intercepted weekly) is collected and used to train its systems to get smarter at preventing them -- which further attracts new clients.

For the second quarter of fiscal 2024 (ending July 31, 2023), analysts expect CrowdStrike to report revenues of $720 million to $736 million, implying a year-over-year upside of 34% to 42%. Analysts are also guiding for generally accepted accounting principles (GAAP) earnings per share (EPS) of $0.54 to $0.58 in the second quarter. According to checks conducted by Barclays analyst Saket Kalia, CrowdStrike is expected to report a "strong pipeline of deals" wherein enterprises will contract for eight or more modules.

CrowdStrike's cybersecurity business has proved quite resilient, even when the companies had cut down on their IT spending. Hence, this stock can prove to be an attractive pick for investors keen on investing in burgeoning AI trends in the cybersecurity space.