App insights settings in azure function app are not working - azure

I am able to configure app insight directly from app insight tab, by either creating new one or selecting the existing one. In this case, it is updating APPINSIGHTS_INSTRUMENTATIONKEY and APPINSIGHTS_CONNECTION_STRING in app settings.
But, when I tried to configure app insights through app setting directly, its not working. I have configured APPINSIGHTS_INSTRUMENTATIONKEY and APPINSIGHTS_CONNECTION_STRING in app settings of a azure function app to directly. But, the related app insight is not integrated with function app.
Can anyone suggest, why it is not working.?

Looking at the release notes for SDK Version 2.0.12998:
App Insights configuration will use the APPLICATIONINSIGHTS_CONNECTION_STRING app setting if it is set (APPINSIGHTS_INSTRUMENTATIONKEY is the fallback and continues to work as-is).
Furthermore, if you read the documentation for App Insights Connection String, you will notice that when you use connection string, you can specify custom endpoints. This is not possible if you just specify the instrumentation key. In that case, SDK will connect to default endpoints.

Related

No data for my application insights live metrics with .NET Core 3.1

I'm trying to setup Application Insights on my ASP.NET Core 3.1 web application but without success...
I installed the version 2.16 of "Microsoft.ApplicationInsights.AspNetCore", then add the following line in the startup.cs file:
services.AddApplicationInsightsTelemetry(_configuration);
Moreover, I added the following section in the appSettings:
"ApplicationInsights": {
"InstrumentationKey": "XXX"
}
When I launch this with Visual Studio, I can see data in Live metrics, however, as soon as I deploy this in the production server with IIS, it just display that the application is off. I tried to put the connection string instead, without luck.
I'm suspecting a proxy issue, however, I have no way to be sure of this and it seems unlikely because I'm using the proxy as well on my local machine where it works.
I put the log level of the application on "Information" and I see nothing related to Application Inisights. I even tried to enable the developer mode, it didn't change anything.
The main issue is that I have no error anywhere, so I don't even know what to search :-)
I have encountered the same situation as you, but I'm not sure if we are facing the same error because of no error message.
I have my own ASP.NET Core 3.1 web application and I did the same configuration in my project, and when run it by vs in local environment, azure application insights can show live metrics, when have deployed in azure app service, it shows 'your app is offline'.
In my scenario, it's result from web app instance creation. When I creating an app service, it will create new application insights as default. Like the screenshot below, and of course the new one has different instrumentation key from the key in 'appSetting.json', it caused that when I look into application sights configured in the project, I can't see live metrics but I can see in the application sights that has the same name with app service.
And when creating app service with new application insights, the configuration tab in web app will display some keys like below, and they won't exist if didn't create new insights.
Upon this situation, I tried to modify these two keys with the value of insights that is used in project, and then live metrics worked.
Priority for obtaining the insights configuration may lead to my problem, because there are several ways to set connection.

Unable to save Application Settings in Azure Function App which I was able to save successfully previously

I am getting an error message while trying to save application settings which I have added for the Function App.
I had created a function app and have been using it for Azure functions. I had previously successfully added Application setting for a config parameter in the azure function application settings and have been using this in code. This time when I went to add another application settings suddenly it started giving the error "Cannot change the site to the App Service Plan EastUSPlan due to hosting constraints". Nothing has been changed and on previous occassions, I was able to add application settings this way. I have tried following the solutions in below link on using previous or pre URL for azure functions and also to clear cache and try on different browsers.
Azure App Service : can't save application settings
I want to successfully save a new config property in azure function as I was doing previously by adding an entry under Application Settings. How can I save the application settings entry in such a case?
Thank You.
One alternative workaround which worked for me was to delete the function app, create a new function app by the same name, add the application settings in the newly created function app (before deploying any code). It allowed me to save the application settings. Only after this, I deployed the code.
For now to unblock yourself you can use REST API :
Web Apps - Update Application Settings
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings?api-version=2016-08-01
But Share the screen shot of the error from the portal. Also I may required further information from your side if the issue still persist so that I can get it rectified from portal perspective also.

Why Application insight is not working after doing slot swapping in azure app service?

I am using application insight for measuring performance and also storing some telemetry data of my web application and it was working fine till last month.
But from last month I am unable to see any traffic in app insight. In last month just I have added one slot in my app service. I have checked instrumentation key, it's same and correct and there is no change in application settings and configuration in app service.
Could you please suggest me if any additional settings I need to take care ?
I suspect this issue is due to adding of slot because in other environment it's working fine.
You could go to Visual Studio configure Application Insights through there and then redeploy the application to slot.
For more information, you could refer to this doc: Application Insights support for Multiple Environments, Stamps and App Versions, , specifically the 'Multi Stamp Support'.
How are you enabling application insights for the App in Azure Web App? Are you using extensions or do you take nuget dependency at build time?
If using extension, please navigate to this url to find the status of application insights enablement: https://yoursitename.scm.azurewebsites.net/ApplicationInsights
Have you ensured that that instrumentation key is available in all slots? This is most likely an instrumentation key issue.

How to share application settings between app services in Azure?

I have several App Services in Azure: development, test, and production. I would like to share some application settings between them like variable sets in Octopus.
Let's say I have a key A which should be same in all App Services. I would like to set its value in one place but seems that I have to configure it to each App Service. When A is changed, I have to change it to everywhere instead of having one common place to change it. Is there some way to do this?
No built-in way, app settings are part of the App Service resource.
You will need to put the settings in a common database or file.
Azure Key Vault can be used for sensitive settings and table storage/blob storage works well for other settings. Azure SQL is also an option.
Your app will then need to load these settings at startup.
This is also a documented cloud design pattern: https://learn.microsoft.com/en-us/azure/architecture/patterns/external-configuration-store

What is the difference between Azure Function App Settings and Application Settings

When setting up an Azure function you have the option to add 'Function App Settings' and also 'Application Settings' and I am confused about when you would use one over the other - can anybody explain the correct use-cases for each of the Setting types?
We could get the answer from How to manage a function app in the Azure portal.
Function app settings: where you can update the Functions runtime version used by your function app. It is also where you manage the host keys used to restrict HTTP access to all functions hosted by the function app.
Application settings blade is where you configure and manage framework versions, remote debugging, app settings, and connection strings. When you integrate your function app with other Azure and third-party services, you can modify those settings here.

Resources