All right, so you're saying that you have two directly related branches and you want to merge a specific changeset. You're able to do it manually in Visual Studio, but when you try to do it through Powershell in a an Azure DevOps pipeline, you're getting an authorization error. Is that correct?
I suggest you test your process in smaller pieces. Forgot the pipeline for now and test whether you're able to do it from your machine.
If not, share your Powershell code with us.
If it succeeds, you'll see that your actual question changes. You won't ask anymore how to merge changesets, because you'll know that. Your question will be how to do the authorization from Azure DevOps pipelines. Then tell us how you're doing the call there.