Because, on next February 2024 the Classic Application Insight will be retired. It would be great if you consider to export Application Insight logs to Azure Storage Account as backup data.
Following the steps as below
1. Create a container in Azure Storage Account you want to export to
2. Write Powershell script
# connnect account:
connect-azaccount
# set correct AZ context:
set-azcontext "your subscription name"
# create context:
$context = New-AzStorageContext -StorageAccountName "your_storage_account_name" -StorageAccountKey "<primary storage key>"
$sastoken = New-AzStorageContainerSASToken -Name your_container_name -Context $context -ExpiryTime (Get-Date).AddYears(25) -Permission w
$sasuri = https://your_storage_account_name.blob.core.windows.net/your_container_name + $sastoken
New-AzApplicationInsightsContinuousExport -ResourceGroupName "your_resource_group_name" -Name "your_application_insight_service_name" -DocumentType "Request", "Custom Event", "Exception", "Metric", "Page View", "Page Load", "Dependency", "Performance Counter", "Availability", "Trace" -StorageAccountId "/subscriptions/your_subscription_id/resourceGroups/your_resource_group_name/providers/Microsoft.Storage/storageAccounts/your_storage_account_name" -StorageLocation your_storage_account_location -StorageSASUri $sasuri
Once you have run the script, you can double check the result by running a command
Get-AzApplicationInsightsContinuousExport -ResourceGroupName your_resource_group_name -Name your_application_insight_service_name
Important:
Continuous export will be deprecated on February 29, 2024 and is only supported for classic Application Insights resources. Azure Stream Analytics does not support reading from AppInsights with diagnostic settings.
Reference:
https://learn.microsoft.com/en-us/azure/stream-analytics/app-insights-export-stream-analytics
0 Comments
Post a Comment