|
| 1 | +--- |
| 2 | +title: Diagnostic Settings Transition from Legacy Solutions |
| 3 | +description: Provides step-by-step guidance on diagnostic settings transition from legacy solutions. |
| 4 | +ms.date: 07/09/2025 |
| 5 | +ms.reviewer: v-liuamson |
| 6 | +ms.service: azure-monitor |
| 7 | +ms.custom: I can’t configure export of Activity Logs |
| 8 | +--- |
| 9 | +# Diagnostic Settings Transition from Legacy Solutions |
| 10 | + |
| 11 | +## Resolve Transition Issues from Legacy Azure Activity Log Solutions |
| 12 | + |
| 13 | +This article addresses the transition from legacy solutions for forwarding Azure activity logs to new diagnostic settings. The legacy solution will be retired on September 30, 2026, and this change will occur automatically without disrupting your workflow. However, if you have automation using the legacy API, you will need to update it. |
| 14 | + |
| 15 | +### Step-by-Step Instructions to Resolve Transition Issues |
| 16 | + |
| 17 | +1. **Verify Current Configuration** |
| 18 | + - Navigate to **Azure Portal**. |
| 19 | + - Go to **Monitor** > **Activity Log** > **Export Activity Log**. |
| 20 | + - Select your subscription from the dropdown and ensure a diagnostic setting is configured. |
| 21 | + |
| 22 | +2. **Update Automation Scripts** |
| 23 | + - If you have scripts using the legacy API, update them to use the **diagnostic settings API** by September 30, 2026. |
| 24 | + - Refer to the [Azure Diagnostic Settings API Documentation](https://learn.microsoft.com/azure/azure-monitor/essentials/activity-log?tabs=powershell#legacy-collection-methods) for guidance. |
| 25 | + |
| 26 | +3. **Check Log Analytics Workspace** |
| 27 | + - Ensure the destination Log Analytics Workspace is active. |
| 28 | + - If the workspace is inactive, change the destination to an active subscription. |
| 29 | + |
| 30 | +4. **Run PowerShell Script to List Diagnostic Settings** |
| 31 | + - Open **Azure Cloud Shell** or any PowerShell connected to your tenant. |
| 32 | + - Run the following script to list all diagnostic settings across your subscriptions: |
| 33 | + |
| 34 | +```powershell |
| 35 | + # Install and login with Connect-AzAccount |
| 36 | + If ($null -eq (Get-Command -Name Get-CloudDrive -ErrorAction SilentlyContinue)) { |
| 37 | + If ($null -eq (Get-Module Az -ListAvailable -ErrorAction SilentlyContinue)){ |
| 38 | + Write-Host Installing Az module from default repository |
| 39 | + Install-Module -Name Az -AllowClobber |
| 40 | + } |
| 41 | + Write-Host Importing Az |
| 42 | + Import-Module -Name Az |
| 43 | + Write-Host Connecting to Az |
| 44 | + Connect-AzAccount |
| 45 | + } |
| 46 | + # Get all Azure Subscriptions |
| 47 | + $Subs = Get-AzSubscription |
| 48 | + # Set array |
| 49 | + $DiagResults = @() |
| 50 | + # Loop through all Azure Subscriptions |
| 51 | + foreach ($Sub in $Subs) { |
| 52 | + Set-AzContext $Sub.id | Out-Null |
| 53 | + Write-Host Processing Subscription: ($Sub).name |
| 54 | + # Get all Azure resources for current subscription |
| 55 | + $Resources = Get-AZResource |
| 56 | + # Get all Azure resources which have Diagnostic settings enabled and configured |
| 57 | + foreach ($res in $Resources) { |
| 58 | + $resId = $res.ResourceId |
| 59 | + $DiagSettings = Get-AzDiagnosticSetting -ResourceId $resId -WarningAction SilentlyContinue -ErrorAction SilentlyContinue | Where-Object { $_.Id -ne $null } |
| 60 | + foreach ($diag in $DiagSettings) { |
| 61 | + # Store all results for resource in PS Object |
| 62 | + $item = [PSCustomObject]@{ |
| 63 | + ResourceName = $res.name |
| 64 | + DiagnosticSettingsName = $diag.name |
| 65 | + StorageAccountName = $diag.StorageAccountId |
| 66 | + EventHubName = $diag.EventHubAuthorizationRuleId |
| 67 | + WorkspaceName = $diag.WorkspaceId |
| 68 | + Subscription = $Sub.Name |
| 69 | + ResourceId = $resId |
| 70 | + DiagnosticSettingsId = $diag.Id |
| 71 | + } |
| 72 | + Write-Host $item |
| 73 | + # Add PS Object to array |
| 74 | + $DiagResults += $item |
| 75 | + } |
| 76 | + } |
| 77 | + } |
| 78 | + # Save Diagnostic settings to CSV as tabular data |
| 79 | + $DiagResults | Export-Csv -Force -Path .\AzureResourceDiagnosticSettings-$(get-date -f yyyy-MM-dd-HHmm).csv |
| 80 | +``` |
| 81 | + |
| 82 | +## Reference |
| 83 | +- [Azure Diagnostic Settings Documentation](https://learn.microsoft.com/azure/azure-monitor/essentials/activity-log?tabs=powershell#legacy-collection-methods) |
| 84 | +- [Azure Monitor Overview](https://learn.microsoft.com/azure/azure-monitor/overview) |
| 85 | + |
| 86 | +If the issue persists after following the solution steps, please open a support case for further assistance. |
0 commit comments