'How to pass a value in a text file to Azure Devops variable and use in another task

I have the following Powershel script that reads a text file. The value that is read is a value I want to pass as a variable to another step in the Azure Devops yml file

$data = Get-Content .\cluster_txt.txt
Write-Output $data

How can I access the value in $data in another task



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source