I have a backend service that is connected to my web site which is hosted in Azure App Service using a Hybrid Connection. When setting up a Hybrid Connection it is useful to be able to test connectivity to your backend service. I’ve previously posted a video to show you to access the Kudu control panel so that you can look at the files in the hosted site. We’ll use the Kudu control panel to also test connectivity, only this time we’ll use the PowerShell debug console.
In Azure Portal click on your app service and go to Advanced Tools and select Go
This will open the Kudu console in a new tab.
Click on Debug console the PowerShell
This opens the debug console in PowerShell and allows your to run PowerShell commands on the App Service. As you are running on the App Service you will have access to the backend service that is connected via the web service.
My service has a Get endpoint that I can call to test connectivity. There are a number of commands we could run but I’ll use Invoke-WebRequest.
For this I am using www.bing.com but you use the url of your backend service that you have configured in your Hybrid Connection.
Invoke-WebRequest -Uri http://www.bing.com
This returns the following error
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.
The error says what you need to do. Add UseBasicParsing to the command
Invoke-WebRequest -Uri http://www.bing.com –UseBasicParsing
We now get the error:
Win32 internal error "The handle is invalid" 0x6 occurred while reading the console output buffer
To fix this we need to tell PowerShell to silently continue by issuing the following command:
$progressPreference = "silentlyContinue"
Then call your web request
I’ve now got the output from the web request with a status code of 200 showing I’ve got connectivity.