Purge Azure App Insight data after hitting daily cap

Harjani, Ashish 201 Reputation points


We have a need where we are hitting daily cap on our Azure app insights and further logging can't be done. Is there a way that after daily cap is hit, we can purge the data for that day immediately and then further logging for that day can come in ? This need is in non - prod environment since we don't want that data to be stored for longer basis we are fine to delete the data after it hits the daily cap.

Thanks !

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,862 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. SwathiDhanwada-MSFT 17,881 Reputation points

    @Harjani, Ashish You can purge Application Insights data using REST API. You can create an activity alert whenever daily cap is hit its warning level and using action groups feature of Azure Monitor , you can trigger a logic app or webhook which purges the application insights data. If you are using classic application insights , I would suggest you to use this Application Insights REST API . If you are using workspace based application insights, I would suggest you to use WorkSpace Purge REST API.

    Also note that the data will not be deleted immediately, it may take upto 72 hours for completing purge operation. When you execute Purge operation you will be prompted with an operation Id, which can be used for checking the purge status.

    Purge is a highly privileged operation that no app or user in Azure (including even the resource owner) will have permissions to execute without explicitly being granted a role in Azure Resource Manager. This role is Data Purger and should be cautiously delegated due to the potential for data loss.

    Reference articles for more information:

    0 comments No comments