AT&T announced on Tuesday that it will sell its advertising unit, Xandr, to Microsoft, abandoning a venture that had proved to be too costly for the telecom giant.

Xandr was founded in 2018 after the acquisition of an ad exchange and a TV ad tech business. Its mission is to target consumers using data acquired from phone, internet, and television services.

AT&T has invested billions to create a media firm, satellite TV provider, and advertising platform all under one roof, but the corporation's intentions have been criticized by investors as it tries to cut debt.Microsoft Renews Global Contract with Xandr | Xandr

The proposed $43 billion merger of WarnerMedia's media assets with Discovery is expected to close by the middle of 2022, according to the telecom operator.

Microsoft makes the majority of its money from the licensing of software like Windows and Office, but it also has ad-supported companies like its Bing search engine, MSN news service, and LinkedIn corporate social network.

"Microsoft can speed up the delivery of its digital advertising and retail media solutions, shaping tomorrow's digital ad marketplace into one that respects consumer privacy preferences, understands publishers' relationships with consumers, and helps advertisers achieve their objectives," said Microsoft's President of Web Experiences, Mikhail Parakhin.

The purchase is subject to regulatory approval and excludes the advertising sales business that supports DirecTV.

In early trade, AT&T's stock was up around 1.4%.