Profile picture of Liam Moat

Liam Moat

Premier Field Engineer.

Azure App Services - Ping with Kudu

By Liam Moat. . 2 minutes read.

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.

Figure 1: Console

Tip: To get a full list of commands available just type help and hit enter.

tcpping

App Service instances block ICMP (Internet Control Message Protocol), so you can’t use the traditional ping command.

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

Other Commands

In addition to tcpping there are two additional commands that you should find useful when troubleshooting network issues with App Services.

nameresolver

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: 
	54.192.28.201
	54.192.28.230
	54.192.28.164
	54.192.28.70
	54.192.28.41
	54.192.28.38
	54.192.28.107
	54.192.28.183
Aliases: 
	d1ajn6pup3omqy.cloudfront.net

curl

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.

curl https://www.liammoat.com/feed.xml

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.

Recent Posts