Application Insights for Azure Cloud Service Project -- Need some guidance


  • Hi Team,

    I have successfully implemented Application Insights for my Azure Web App Project and It's working well. I also have externalized Instrumentation Key so that, I can use update that based on my environment (Dev\QA\Prod).

    Now, I want to use Application Insights in my Cloud Service Project. Not the same App Insights but with Different account and all. So, everything from scratch.

    Cloud Service is having Azure 2.7 SDK and .Net Framework 4.5. From Azure Side, It's having Classic Cloud Service Model and I have created new Application Insights account for this specific purpose.

    Now, I want to add that in my solution/project. According to the article

    I suppose to right click on my Web/ Worker Project and add NuGet Package for ApplicationInsights.Web but When I right click on Project I can see the direct option "Add Application Insights". I am hoping that it's shortcut for the same NuGet Package root. Isn't It?

    Now, Second anomaly I experienced with,

    When I add this in my WebRole Project, along with another packages/ references it added ApplicationInsights.config at the root level of my project which has InstrumentationKey also inside.

    But according to the above article It suppose to be with Azure Project (Where we have cscfg and csdef files) instead of WebRole or WorkerRole Project.

    Based on all above experience, To Add Application Insights in Cloud Service is nothing but to add that in our WebRole Project the same way we have in normal Web Application (Azure Web App) There is no role of Cloud Project we have in solution for this specific (Application Insights) 

    Please correct me wherever you feel I am wrong.


    Regards, Brijesh Shah

    Friday, April 15, 2016 4:35 AM


  • Hi Brijesh,

    Almost everything is correct. Couple notes:

    - For worker roles you do not need Web nuget package, you need Windows Server

    - When you use option "Add Application Insights" you can select AI resources and correct IKey would be added to ApplicationInsights config automatically. When you just add nuget iKey is not automatically added and you need to copy it from the portal.

    - You are right that iKey is added to AppInsights config. That would work just fine but recommendation is to remove it from there and initialize it from cscfg so you can split iKeys by environment. You would need to do that manually


    Friday, April 15, 2016 10:44 PM