Service not enabled within domain when using Azure and Powershell script

Hi all,

We are having an issue in trying to automate some steps in our azure deployment pipeline where we are trying to get an access token to be able to delete test users in our automated test scenario.

Now, I have made a powershell script that runs perfectly fine from my local machine, but as soon as I run this script in our pipeline, we get the following error:
Service not enabled within domain: /api/v2

Am I missing something somewhere, because it makes no sense why its complaining about my audience as it should have given me the same issue when running from local?