8

I've got a project in VS 2017 v15.4.0 Preview 3 and a while back I published the Web service to Azure with Application Insights enabled. I've since removed the web service and its associated AI resource from the Azure Portal, however now Visual Studio is reporting the following error:

enter image description here

The account does not have permission to access the Application Insights resource '<resourcename>'. Please select an account that has access to the reseource:

I can dismiss it but it continues to pop up about once or twice a day. Where do I unconfigure this?

pcdev
  • 2,852
  • 2
  • 23
  • 39

1 Answers1

8

OK, it turned out to be hidden away in the Application Insights Search page. Here's how to configure it to point to the correct AI resource:

Show the Application Insights Toolbar by selecting it from View > Toolbars > Application Insights:

Application Insights Search

This highlights the issue. You need to remove the following two lines from your .csproj file (Right-click project, Edit .csproj):

<ApplicationInsightsResourceId>/subscriptions/[SUBSCRIPTION_ID]/resourcegroups/[RESOURCE_GROUP_NAME]/providers/microsoft.insights/components/[RESOURCE_NAME]</ApplicationInsightsResourceId>
<ApplicationInsightsAnnotationResourceId>/subscriptions/[SUBSCRIPTION_ID]/resourcegroups/[RESOURCE_GROUP_NAME]/providers/microsoft.insights/components/[RESOURCE_NAME]</ApplicationInsightsAnnotationResourceId>

Save the file and right-click the project again, and you should see Configure Application Insights... again. Click this and reconfigure for the new (or existing) AI Resource.

I also had to use the AI toolbar button to select Configure Application Insights:

enter image description here

Then configure the resource settings:

enter image description here

Alternatively, if you want to remove Insights from the project altogether, see this answer.

pcdev
  • 2,852
  • 2
  • 23
  • 39