Azure Sentinel News
  • Home
    • Home – Layout 1
    • Home – Layout 2
    • Home – Layout 3
  • Security and Compliance
  • SOC
  • Threat Intelligence
  • Security Ochestration & Automated Response
  • SOAR
  • Security Operations
  • Artificial Intelligence
No Result
View All Result
  • Home
    • Home – Layout 1
    • Home – Layout 2
    • Home – Layout 3
  • Security and Compliance
  • SOC
  • Threat Intelligence
  • Security Ochestration & Automated Response
  • SOAR
  • Security Operations
  • Artificial Intelligence
No Result
View All Result
Azure Sentinel News
No Result
View All Result
Home KQL

How to Export and Backup Azure Sentinel Tables Using PowerShell

Azure Sentinel News Editor by Azure Sentinel News Editor
December 29, 2020
in KQL
0
ForgeRock Joins Microsoft Intelligent Security Association
2.1kViews
696 Shares Share on Facebook Share on Twitter

I’ve worked with several customers recently who still like to be able to work offline somewhat. It’s been part of their normal processes for a long while and has become a partial a habit due to working with legacy, on-premises security tools for so long. I try to teach better ways to modernize the processes that are exposed by using a modern, cloud-based SIEM like Azure Sentinel, but habits are hard to break. They have found that, due to the slowness of the old tool’s query language against the sea of data they are storing, it’s just been easier to offload data to an external file and work against that. Of course, thanks to the value of Azure, Log Analytics, and KQL, Azure Sentinel customers don’t have to do this any longer. But, for those that do, here’s a quick solution.

NOTE: For a more current method of doing this see: How to Automate the Backup of Azure Sentinel Tables to Blob Storage Using PowerShell. However, the more current method only supports certain tables and not custom tables. To backup non-supported and custom tables, continue on…

If you’ve worked with Azure Sentinel, you should know that there’s an option in the Logs blade to export query results, as shown in the image.

Export Query Results to a CSV or Power BI

However, because – yes – we are also talking about customers who want to work offline, a PowerShell script is also palatable in this scenario. For that reason, I put together the PowerShell script shown below.

The script does the following:

  1. Logs into Azure
  2. Initiates downloading a table stored in Log Analytics (you’ll need to supply the table and your Log Analytics workspace ID) based on a KQL query that simply
  3. Saves the downloaded data into a .csv in a C:\SentinelTables folder locally. The folder will needs to be created manually (or you can change the destination variable). The filename will be TableName+data.csv.

You can also just stop operation of the script (Ctrl-C) to stop downloading data and work with what has already been exported locally.

Here’s the PowerShell script:

# Authenticate to AzureRM
Login-AzureRmAccount

#==============================================================
# Define environment variables
#==============================================================
  
    $SavePath  = "C:\SentinelTables"
    $FileDate    = Get-Date -Format "yyyy-MM-dd"
    
# Fill in your Log Analytics workspace ID    
    $WorkspaceID = "xxxxx-xxxxx-xxxxx-xxxxx-xxxxxx"


# Change the TableName to the table you want to extract
    $TableName = "AzureActivity"
  
# Output to CSV
    $OutputCSV   = "$SavePath\$TableName-$FileDate.csv"
  
# Get the Table data from Log Analytics
        $TableResult = Invoke-AzureRmOperationalInsightsQuery -WorkspaceId $WorkspaceID -Query $TableName | select Results -ExpandProperty Results
        $TableResultCount = ($TableResult | Measure-Object).Count


# Fill up the CSV
        If ($TableResultCount -ge 1){
            foreach ($Result in $TableResult){
                $Result | Select * | Export-Csv $OutputCsv -NoTypeInformation -Append
            }
        }

You can also grab the most current version of the script from my GitHub Repo: https://github.com/rod-trent/SentinelPS/blob/master/ExportSentinelTable.ps1

Additionally, this script can be useful for those customers that want to “backup” data from Azure Sentinel to save it longer than the data retention value for the Log Analytics workspace. I’m working on a version that will push the data to Azure blog storage for that purpose.

Also, keep in mind, that while I’m targeting Azure Sentinel data with this PowerShell script solution, this works for any table in any Log Analytics workspace.

Thoughts? Script improvements? Let me know….

Reference: https://azurecloudai.blog/2020/08/06/export-partial-or-complete-data-from-an-azure-sentinel-table/

Azure Sentinel News Editor

Azure Sentinel News Editor

Related Posts

What’s new: Microsoft Teams connector in Public Preview
KQL

New Azure Sentinel Learning Modules Released

February 1, 2021
What’s new: Microsoft Teams connector in Public Preview
KQL

How to Connect the New Intune Devices Log Azure Sentinel

January 26, 2021
What’s new: Microsoft Teams connector in Public Preview
KQL

How to Create a Backup Notification in the Event an Unauthorized User Accesses Azure Sentinel

January 11, 2021
Next Post
Introducing the Microsoft Azure Modular Datacenter

Azure Sentinel: Sending an Email Each Morning with the List of Daily Incidents Created

What’s new: Microsoft Teams connector in Public Preview

Adding MBAM/Bitlocker Logs to Azure Sentinel

With new release, CrowdStrike targets Google Cloud, Azure and container adopters

Managing Disconnected Azure VMs for Azure Sentinel

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Follow Us

  • 21.8M Fans
  • 81 Followers

Recommended

Microsoft is quietly becoming a cybersecurity powerhouse

How to Prohibit an Azure Sentinel Analyst from Editing a Playbook

2 months ago
Alcide Joins Microsoft Intelligent Security Association (MISA) and integrates their Kubernetes security, Alcide kAudit, with Microsoft Azure Sentinel

Alcide Joins Microsoft Intelligent Security Association (MISA) and integrates their Kubernetes security, Alcide kAudit, with Microsoft Azure Sentinel

4 months ago
CRITICALSTART Adds Support for Microsoft Azure Sentinel to MDR Services

Creating an Azure Sentinel Taskbar and Start Menu Shortcut and Icon for Quick Access

2 months ago
Microsoft is quietly becoming a cybersecurity powerhouse

Hunting the Clues- Azure Sentinel Administrative Suspicious Activities Library

3 months ago

Instagram

    Please install/update and activate JNews Instagram plugin.

Categories

  • AI & ML
  • Artificial Intelligence
  • Incident Response
  • IR
  • KQL
  • Security and Compliance
  • Security Ochestration & Automated Response
  • Security Operations
  • SIEM
  • SOAR
  • SOC
  • Threat Intelligence
  • Uncategorized

Topics

anomaly automation Azure Azure DevOps Azure Security Center Azure Sentinel Azure Sentinel API Azure Sentinel Connector BlueVoyant Call cybersecurity Detection file GitHub Hunting Huntingy IAC incident response Incident Triage infrastructure as code Investigation jupyter LAQueryLogs MDR Microsoft microsoft 365 mssp Multitenancy Notebooks Pester Playbooks PowerShell python Records Security Sentinel Sharing SIEM signin Supply Chain teams Threat hunting Watchlists Workbooks XDR
No Result
View All Result

Highlights

New Items of Note on the Azure Sentinel GitHub Repo

Tuning the MCAS Analytics Rule for Azure Sentinel: System Alerts and Feature Deprecation

New Search Capability for Azure Sentinel Incidents

Follow-up: Microsoft Tech Talks Practical Sentinel : A Day in the Life of a Sentinel Analyst

Changes in How Running Hunting Queries Works in Azure Sentinel

Azure Sentinel can now Analyze All Available Azure Active Directory Log Files

Trending

What’s new: Microsoft Teams connector in Public Preview
IR

How to Generate Azure Sentinel Incidents for Testing

by Azure Sentinel News Editor
February 26, 2021
0

Do you want to generate an Incident in Azure Sentinel for testing/demoing? Here’s a couple easy ways...

What’s new: Microsoft Teams connector in Public Preview

Azure Sentinel Notebooks Loses It’s Preview Tag

February 25, 2021
Microsoft’s newest sustainable datacenter region coming to Arizona in 2021

The Holy Grail of Azure Sentinel Data Connections: The Azure Service Diagnostic Setting

February 22, 2021
Microsoft’s newest sustainable datacenter region coming to Arizona in 2021

New Items of Note on the Azure Sentinel GitHub Repo

February 18, 2021
Microsoft’s newest sustainable datacenter region coming to Arizona in 2021

Tuning the MCAS Analytics Rule for Azure Sentinel: System Alerts and Feature Deprecation

February 17, 2021

We bring you the best, latest and perfect Azure Sentinel News, Magazine, Personal Blogs, etc. Visit our landing page to see all features & demos.
LEARN MORE »

Recent News

  • How to Generate Azure Sentinel Incidents for Testing February 26, 2021
  • Azure Sentinel Notebooks Loses It’s Preview Tag February 25, 2021
  • The Holy Grail of Azure Sentinel Data Connections: The Azure Service Diagnostic Setting February 22, 2021

Categories

  • AI & ML
  • Artificial Intelligence
  • Incident Response
  • IR
  • KQL
  • Security and Compliance
  • Security Ochestration & Automated Response
  • Security Operations
  • SIEM
  • SOAR
  • SOC
  • Threat Intelligence
  • Uncategorized

[mc4wp_form]

Copyright © 2020 - Azure Sentinel News

No Result
View All Result
  • Home
  • Security and Compliance
  • SOC
  • Threat Intelligence
  • Security Ochestration & Automated Response
  • SOAR
  • Security Operations
  • Artificial Intelligence

Copyright © 2020 Azure Sentinel News