Working with Azure App Services often involves an element of networking. A straight forward example could include making a request to an internet routable web service. You might be using a Hybrid Connection to access an on-premise resource. A more complex scenario could involve a Virtual Network and Azure’s ExpressRoute. If any of these sound familiar, you will probably have wanted to try and
ping your target endpoint.
If you were running on a virtual machine, that would be easy. Remote desktop to the machine, open up CMD and start “pinging”. But, what about App Services?
In App Services, we turn to Kudu and the built in Debug Console. You can access the embedded Console directly in the App Service blade. Or, you can access it from your site’s Kudu services - go to https://[siteName].scm.azurewebsites.net and select Debug Console from the navigation page.
Tip: To get a full list of commands available just type
help and hit enter.
App Service instances block ICMP (Internet Control Message Protocol), so you can’t use the traditional
ping www.liammoat.com Unable to contact IP driver. General failure.
Fortunately, Azure provides an alternative -
tcpping. This opens a TCP socket to a target, using the hostname and port, and returns whether the initial handshake was successful and a connection was established.
tcpping www.liammoat.com:443 Connected to www.liammoat.com:443, time taken: 115ms Connected to www.liammoat.com:443, time taken: <1ms Connected to www.liammoat.com:443, time taken: 1ms Connected to www.liammoat.com:443, time taken: <1ms Complete: 4/4 successful attempts (100%). Average success time: 29ms
In addition to
tcpping there are two additional commands that you should find useful when troubleshooting network issues with App Services.
Attempt to resolve any given hostname and see what DNS information is available to the App Service instance.
nameresolver www.liammoat.com Server: 10.220.1.2 Non-authoritative answer: Name: d1ajn6pup3omqy.cloudfront.net Addresses: 184.108.40.206 220.127.116.11 18.104.22.168 22.214.171.124 126.96.36.199 188.8.131.52 184.108.40.206 220.127.116.11 Aliases: d1ajn6pup3omqy.cloudfront.net
It is great to see
curl is available in the Debug Console on App Services. Amongst its many purposes and use cases, the most common is likely to be troubleshooting that HTTP endpoints not only resolve, but return a valid response - in a timely manner.
I hope you find these three commands as useful as I do on a daily basis. Take a look at the Kudu wiki to discover some more really useful features you need when managing App Services.