When you want to collect IP addresses in Azure App Insights, you have to enable it. By default IP addresses are masked and you can only see some basic information like city or country.
If you want to enable this feature you can’t use Azure Portal, at least for now. The easiest way to do it, is to use Azure Resource Explorer.
- Go to https://resources.azure.com/ and pick proper AD you want to work with
- Click on
Read/Write
mode in top of the page. - Find your App Insight instance by going into
subscriptions / YOUR_SUBSCRIPTION / resourceGroups / YOUR_RESOURCE_GROUP / providers / microsoft.insights / components
- In Data tab click on
Edit
- Remove the content of the
properties
property and put "DisableIpMasking": true
- Hit
Patch
button since we are changing the part of the resource definition. - Done!
Example JSON payload
{
"id": "/subscriptions/XXX/resourceGroups/XXX/providers/microsoft.insights/components/XXX",
"name": "XXX",
"type": "microsoft.insights/components",
"location": "westeurope",
"tags": {},
"kind": "web",
"etag": "\"XXX\"",
"properties": {
"DisableIpMasking": true
}
}
Also this part of a documentation may be useful https://docs.microsoft.com/en-us/azure/azure-monitor/app/ip-collection