SOLVED
Home

Command to list backups for the past number of days.

%3CLINGO-SUB%20id%3D%22lingo-sub-210834%22%20slang%3D%22en-US%22%3ECommand%20to%20list%20backups%20for%20the%20past%20number%20of%20days.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-210834%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%20I'm%20trying%20to%20figure%20out%20how%20to%20generate%20a%20report%20in%20Log%20Analytics%2FPowerShell%20that%20will%20list%20VM's%20that%20have%20backed%20up%20successfully%20and%20which%20did%20not.%20Does%20anyone%20have%20an%20idea%20of%20how%20I%20can%20do%20this%20via%20PowerShell%20or%20using%20Log%20Analytics%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-210834%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EApplication%20Insights%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20Log%20Analytics%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowershell%20and%20Rest%20API%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EQuery%20Language%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESolutions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-213243%22%20slang%3D%22en-US%22%3ERe%3A%20Command%20to%20list%20backups%20for%20the%20past%20number%20of%20days.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-213243%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Richard%2C%3C%2FP%3E%0A%3CP%3EIf%20you%20backup%20through%20Azure%2C%20Log%20Analytics%20has%20a%20solution%20you%20can%20install%2C%20named%20%22Azure%20Backup%20Monitoring%20solution%22%20with%20a%20dashboard%20of%20many%20backup%20details%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F37233i49794017E580455E%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Azure%20backup%20monitoring%20solution.png%22%20title%3D%22Azure%20backup%20monitoring%20solution.png%22%20%2F%3E%3C%2FSPAN%3E%3CBR%20%2F%3EYou%20can%20drill%20through%20the%20charts%20to%20see%20the%20raw%20query%20and%20results%20in%20Log%20Analytics%2C%20or%20write%20a%20custom%20query%20like%20%3CA%20href%3D%22https%3A%2F%2Fportal.loganalytics.io%2Fsubscriptions%2Fe4272367-5645-4c4e-9c67-3b74b59a6982%2Fresourcegroups%2Fcontosoazurehq%2Fworkspaces%2Fcontosoretail-it%3Fq%3DH4sIAAAAAAAAA12PywrCMBBF937F0FX7A%252B4qVAXRhYKvbZk2QwyapE4SpMWPN6lQweXMPXOYWw2Baa1QGuu8at3sDa8bMcFZadqQIUZPAhaA0uZzUcAErGIgLfdQlpBVSbPE9h66I3WWfTZxhy45lDV71DTCO9v84jhMRO3G%252FOtJiAtaI6uBoJKSSaZfrvgI0QOitcH4PN5fjHoG2opaFtD0yXjy6IOrUxvLgjit%252Fw2CXPsBsC7uNf4AAAA%253D%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ethis%3C%2FA%3E%3A%3C%2FP%3E%0A%3CPRE%3EAzureDiagnostics%0A%7C%20where%20TimeGenerated%20%26gt%3B%20ago(6d)%20%0A%7C%20where%20Category%20%3D%3D%20%22AzureBackupReport%22%0A%7C%20where%20OperationName%20%3D%3D%20%22Job%22%0A%7C%20where%20JobOperation_s%20%3D%3D%20%22Backup%22%0A%7C%20summarize%20AggregatedValue%20%3D%20dcount(JobUniqueId_g)%20by%20JobStatus_s%0A%7C%20order%20by%20AggregatedValue%20desc%3C%2FPRE%3E%0A%3CP%3Ewhich%20counts%20how%20many%20backup%20jobs%20were%20successful%20or%20failed.%3C%2FP%3E%0A%3CP%3EIf%20you%20backup%20through%20another%20process%2C%20you%20can%20track%20the%20events%20reported%20on%20the%20Event%20%2F%20SecurityEvent%20tables.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Richard Oros
Regular Visitor

Hi, I'm trying to figure out how to generate a report in Log Analytics/PowerShell that will list VM's that have backed up successfully and which did not. Does anyone have an idea of how I can do this via PowerShell or using Log Analytics?

1 Reply
Solution

Hi Richard,

If you backup through Azure, Log Analytics has a solution you can install, named "Azure Backup Monitoring solution" with a dashboard of many backup details:

Azure backup monitoring solution.png
You can drill through the charts to see the raw query and results in Log Analytics, or write a custom query like this:

AzureDiagnostics
| where TimeGenerated > ago(6d) 
| where Category == "AzureBackupReport"
| where OperationName == "Job"
| where JobOperation_s == "Backup"
| summarize AggregatedValue = dcount(JobUniqueId_g) by JobStatus_s
| order by AggregatedValue desc

which counts how many backup jobs were successful or failed.

If you backup through another process, you can track the events reported on the Event / SecurityEvent tables.