Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS2017 - Application Insights: The account does not have permission to access the AI resource

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?

like image 674
pcdev Avatar asked Oct 18 '17 04:10

pcdev


People also ask

What is Azure application insights?

Your Application Insights resource collects, analyzes and displays the telemetry data sent from your application. Other types of Azure resources include web apps, databases, and VMs. To see your resources, open the Azure portal, sign in, and click All Resources.

How do I control access to my data in Azure application insights?

You can control who has read and update access to your data in Azure Application Insights, by using Azure role-based access control (Azure RBAC). Assign access to users in the resource group or subscription to which your application resource belongs - not in the resource itself. Assign the Application Insights component contributor role.

How to get access to AI resource in azure WebTest?

I did see the same problem discussed here but with no resolution. Since webtests are an Azure resources themselves. So in order to gain access you will need contributor level access at the ResourceGroup under which your AI resource exists. Hope this helps.

Why does application need permission to access resources in organization?

Application needs permission to access resources in your organization that only an admin can grant. Please ask an admin to grant permission to this app before you can use it. Hello Team, I have used NodeJS Quickstart Application for Single Sign on using OpenID Connect method. I am unable to login and facing the below error:


1 Answers

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.

like image 109
pcdev Avatar answered Oct 26 '22 06:10

pcdev