Yes, setting up the APPINSIGHTS_INSTRUMENTATIONKEY within the appSettings of a Function App, is sufficient to create this association/links, without the need to manually including the hidden-link tags. Azure handles the linking of resources, which simplifies the template and avoids potential misconfigurations.
In my settingup I didn't have hidden-links tags explicitly added to my appinsight block.
resource applicationInsights 'Microsoft.Insights/components@2020-02-02' = {
name: applicationInsights.name
tags: tags // tags here is the normal resource tags, not hidden-links
xxxxx
}
And I have a separate resource block appsettings for my function app slot
resource functionAppName_Slot_appsettings 'Microsoft.Web/sites/slots/config@2022-09-01' = {
parent: functionAppSlot
name: function.appsettingsName
properties: {
APPLICATIONINSIGHTS_CONNECTION_STRING: applicationInsights.properties.ConnectionString
xxx
}
}
When I check the function apps JSON on portal, hidden-links tags are automatically added by Azure, confirming the automatic integration.
"tags": {
"tag1": "xxxxxx",
"tag2": "xxxx",
"tag3": "xxxx",
"tagx": "BVT",
"hidden-link: /app-insights-resource-id": "/subscriptions/xxxx/resourceGroups/name-of-rG/providers/microsoft.insights/components/appinsightsName",
"hidden-link: /app-insights-instrumentation-key": "kayValue",
"hidden-link: /app-insights-conn-string": "InstrumentationKey=keyValue;IngestionEndpoint=https://uksouth-1.in.applicationinsights.azure.com/;LiveEndpoint=https://uksouth.livediagnostics.monitor.azure.com/;ApplicationId=appIdvalue"
},