The first error you might get is this undescriptive one
Run this to check the default TLS version.
If its not Tls12, add this line to the top of your powershell script.
When you now rerun your script you might get this error,
Basically we need to ignore the Self Signed Certificate from the destination endpoint. We can do this by adding the below code after the previous line where we set the TLS version and before your code that calls the endpoint.
That should be it.
Let me know if this worked for you by leaving a comment.