SharePoint monitoring with Microsoft Azure

Page content

After reading this blog of Matthias Einig about using Azure Analytics for your Office 365 portal. I tried this on an clients SharePoint 2013 farm. But I didn’t want to create an app to deploy the JavaScript so I created an Console app to deploy this to the specific site collection.

I first wanted to create a PowerShell script, but that does not work with our farm because of the discovering of the ADFS settings. I created an issue for this on GitHub ( So for the console app I used the OfficeDevPnP core Nuget package (

The console app asks for a few parameters like username, password, domain, url of the site and the path of the JavaScript file that Matthias created in his blog.

The connection to our farm is done by these 2 lines of code

OfficeDevPnP.Core.AuthenticationManager am = new OfficeDevPnP.Core.AuthenticationManager();  ?ClientContext ctx = ?am.GetADFSUserNameMixedAuthenticatedContext(url, username, password, domain, sts, idpld);

After uploading the file to the Style library it sets the custom action just like Matthias explains in his blog.

Try to get 1 step further – Monitor the server

Now that we have insight in our page views, there is an option to install an agent on our server that will monitor it. I installed this on the front-end server of our farm and connect it to the Azure Application Insights instance.

The installation and configuration went well, but when I did an IISReset on the server it killed my SharePoint web application because it is missing a DLL (Microsoft.Web.Infrastucture.dll). This file is not installed with the agent and not available on a SharePoint farm. I have not yet found a nice way to get it installed other than copy it the GAC by hand. When you do this with any other web application and reference the Azure Application Insight from Visual Studio the DLL gets referenced and deployed with your application.

So for now only the page views are monitored until I find a way to deploy this to our servers on a clean way.