I’ve written this post mostly to remind myself of how this works. Hope this can help someone else
When handling a web applications in Azure kudu is a very handy tool. Sometimes you might want to invoke a web request from kudu to for example to see if a service accessed via Hybrid Connection Manager is accessible from a web app using the HCM or if the service only allows traffic from a specific ip-range. I’m usually using powershell so this is how I did it in kudu’s powershell diagnostic console.
You will probably start with trying to write something like:
invoke-webrequest https://path.to/service
This might give you the error message
curl : The response content cannot be parsed because the Internet Explorer engine is not available, or Internet Explorer's first-launch configuration is not complete. Specify the UseBasicParsing parameter and try again.
Fixing this is simple enough, just add the “-UseBasicParsing” parameter.
invoke-webrequest http://path.to/service -UseBasicParsing
This might fix the first problem, but another one might now pop up:
invoke-webrequest : Win32 internal error "The handle is invalid" 0x6 occurred while reading the console output buffer.
To fix this, we need to disable progressbars in powershell:
$ProgressPreference = "SilentlyContinue"
Why you have to do this is well described in the post ”
https://amido.com/blog/powershell-win32-internal-error-the-handle-is-invalid-0x6/ “
Once you have written that, you can try to execute the curl again and this time you should get a respone. To get the content of the response type the following
(invoke-webrequest http://path.to/service -UseBasicParsing).content