For reasons too long to explain in this post, a PowerShell script I'm running in an unattended PAD flow must log in as another user account for a portion of the script. I used ConvertTo-SecureString to obfuscate the password and store it in a text file (see this article). To keep the file off of local machines, I was hoping to store it only in the OneDrive of the PAD user account. Unfortunately, using the Read file content (OneDrive for Business) action did not work, as it reads the contents in as binary. I also tried using the Read text from file action, but for some reason that was not working either. The only thing that would work is the Get-Content PowerShell command. My concern is that text file will now need to be present on any machine on which the PAD flow will need to run.
Is there a better, and more secure, way to do this?