@Denys Soroka I have tested this scenario with a simple request to get a access token from one of my speech resource from Azure with a powershell request from a windows2012 r2 instance I deployed on Azure. Here is the response of this scenario where the API works fine from the machine.
If you have an on-prem machine then you can try to create one windows 2012 r2 machine and list the systeminfo of the machine to match your on-prem and try a similar request to call the API. I hope this information helps in using the API. Thanks, Please accept this response as answer if it helps.