I am putting together a series for people who are excited to bring Azure into their software development life cycle and use Azure cloud’s extensive services to their full potential.

In this series, I will cover as below:

  1. Getting Started with Azure Development, Create App Service Plan and Publish MVC project using Visual Studio
  2. Deployment Slots and Slot Swap on Azure App Service using Visual Studio and Azure SDK
  3. Remote debugging App Service using visual Studio, monitoring and configuring alerts
  4. Diagnostic logs, live stream, process explorer and KUDU
  5. How to use Azure SQL Database in Dot.net Applications
  6. How to use Azure DocumentDB or Azure Cosmos DB in our Dot.net Applications
  7. How to use Visual Studio Team Service to do continuous Integration and continuous delivery
  8. Azure storage data services types and how to store files in azure storage account 1/2
  9. Azure storage data services types and how to store files in azure storage account 2/2
  10. How to use Azure Functions and trigger on new image/blob creation in Azure Storage using BlobTrigger 1/2
  11. How to use Azure Functions and trigger on new image/blob creation in Azure Storage using BlobTrigger 2/2

If you do not know where to start, please check my blog post, which covers detail about getting subscription and setting up. In this series, we assume that you already have active Azure subscription and Visual Studio 2013 or later installed on your system.

  1. Remote debugging App Service using visual Studio, monitoring and configuring alerts

We have successfully configured the deployment slot in previous post, now we are going for remote debugging. In Azure remote debugging using visual Studio is not enabled by default, you have to enable debugging for specific VS version to debug. Although if you have permissions you can do it by Visual Studio if you do not have enough permissions, please ask your Azure Subscription owner. In our case we are the owner of Azure Subscription so we will proceed for debugging with out requiring any permissions,

If you have not already opened your visual studio, then open it and load the project you had deployed earlier. Now go to Cloud Explorer | your subscription | Select your app | Actions | Click on Attach debugger.

Figure 1 Remote Debugging

Debugger will be attached, it may take some time depending upon your internet connection speed and your location distance to Azure Data center, If you are getting error like below, that means you do not have permissions to debug or you have not enabled Debugging for your App Service, remember by default debugging is not enabled. In my case, it was referring to firewall settings and we found out that there were some ports closed which needed to be opened to communicate with Azure.

Figure 2 Error While connecting to Remote Debugging Session

Go to Azure Portal and then App Service | Settings | Application Settings | Debugging | enable Remote debugging and also choose visual studio version and click save. Now by this step your debugger should be attached successfully.

Figure 3 Enabling Remote Debugging

If you still not able to resolve the problem please consult my recent post which discuss the steps to fix common debugging issues.

Also check Microsoft page

Once you are in debugging mode, you can use all the tools that you use while debugging locally.

App Service Monitoring

Let us move on to monitoring our App Service.

Azure provide you multiple ways to monitor your App Service, Let us explore them, go to Azure Portal and then App Service | Overview, in this view you can see the basic information about http errors, data in, data out, number of requests and Average response time. All though this view will satisfy most users, but you can even drill down and generate custom views for you as well, just click on any of the chart and you will see a new view, in which you can tailor the chart according to your metrics.

Figure 4 Monitoring performance

For demo, We have added CPU Time into the mix, and we can see that display show both Average Response Time and CPU Time as well.

Figure 5 Create Custom chart

You can click on Pin to dashboard to see it on your main dashboard as well.

Figure 6 Pin to dashboard


This bring us to our next topic alerts, alerts can be very useful especially when you have a lot of resources and do not have time to manually check the metrics to see what is going on. We can create alert right on a particular metric by clicking on

Or App Service | Monitoring | Alerts

Let us create an alert on CPU Percentage on our App service Plan ( it will include all the apps hosting on same App Service Plan) and choose CPU Percentage and set condition to “greater than” and threshold to 80. You will notice that the chart shows you current CPU percentage in dotted line and the threshold in straight line, do not forget to check email owners check box if you are the owner and want to get the alert email otherwise there is a textbox to add addition emails or call a webhook. Webhook is a restful endpoint, which is publically accessible to Azure and will be called when metric pass the condition we set. Mostly developer use webhook to initiate a workflow, which could for example increase number of running instances through PowerShell script or initiate a business workflow. To learn more about webhook see https://docs.microsoft.com/en-us/azure/monitoring-and-diagnostics/insights-webhooks-alerts

Figure 7 Create alert on CPU percentage for App Service Plan

As you, can see that I have created two alerts, one for CPU percentage and another for Memory percentage. Now when ever condition you set will meet you will get an email or a webhook will be called. Alerts truly simplify our monitoring task specially if we have a lot of resources to worry about.

Figure 8 Create Alert on CPU and Memory percentage

Congratulations, you have successfully debugged and monitored your application and configured alerts.

Coming up next Diagnostic logs, live stream, process explorer and KUDU


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.