Read more on this post, section Switching target resource reliably:
You need to set the key in application.start in global.asax
We have configured the application Insights in the Azure version of EPIServer CMS 9.3.2 version. I was trying to assign the application insights telemetry key in the MVC Global.asax file. But the application insights Telemetry client is not getting configured with the intrumentation key supplied through the web.config.
I would like to know which is the good place to put the intrumentation key in the EPIServer MVC code