homepage
Menu
Open menu
  • Training
    Go one level top Back

    Training

    • Courses

      Build cyber prowess with training from renowned experts

    • Hands-On Simulations

      Hands-on learning exercises keep you at the top of your cyber game

    • Certifications

      Demonstrate cybersecurity expertise with GIAC certifications

    • Ways to Train

      Multiple training options to best fit your schedule and preferred learning style

    • Training Events & Summits

      Expert-led training at locations around the world

    • Free Training Events

      Upcoming workshops, webinars and local events

    • Security Awareness

      Harden enterprise security with end-user and role-based training

    Featured

    Get a Free Hour of SANS Training

    Free Course Demos

    Can't find what you are looking for?

    Let us help.
    Contact us
  • Learning Paths
    Go one level top Back

    Learning Paths

    • By Focus Area

      Chart your path to job-specific training courses

    • By NICE Framework

      Navigate cybersecurity training through NICE framework roles

    • DoDD 8140 Work Roles

      US DoD 8140 Directive Frameworks

    • By European Skills Framework

      Align your enterprise cyber skills with ECSF profiles

    • By Skills Roadmap

      Find the right training path based on critical skills

    • New to Cyber

      Give your cybersecurity career the right foundation for success

    • Leadership

      Training designed to help security leaders reduce organizational risk

    • Degree and Certificate Programs

      Gain the skills, certifications, and confidence to launch or advance your cybersecurity career.

    Featured: Solutions for Emerging Risks

    New to Cyber resources

    Start your career
  • Community Resources
    Go one level top Back

    Community Resources

    Watch & Listen

    • Webinars
    • Live Streams
    • Podcasts

    Read

    • Blog
    • Newsletters
    • White Papers
    • Internet Storm Center

    Download

    • Open Source Tools
    • Posters & Cheat Sheets
    • Policy Templates
    • Summit Presentations
    • SANS Community Benefits

      Connect, learn, and share with other cybersecurity professionals

    • CISO Network

      Engage, challenge, and network with fellow CISOs in this exclusive community of security leaders

  • For Organizations
    Go one level top Back

    For Organizations

    Team Development

    • Why Partner with SANS
    • Group Purchasing
    • Skills & Talent Assessments
    • Private & Custom Training

    Leadership Development

    • Leadership Courses & Accreditation
    • Executive Cybersecurity Exercises
    • CISO Network

    Security Awareness

    • End-User Training
    • Phishing Simulation
    • Specialized Role-Based Training
    • Risk Assessments
    • Public Sector Partnerships

      Explore industry-specific programming and customized training solutions

    • Sponsorship Opportunities

      Sponsor a SANS event or research paper

    Interested in developing a training plan to fit your organization’s needs?

    We're here to help.
    Contact us
  • Talk with an expert
  • Log In
  • Join - it's free
  • Account
    • Account Dashboard
    • Log Out
  1. Home >
  2. Blog >
  3. Azure Log Extraction
Megan_Roddie_370x370.png
Megan Roddie-Fonseca

Azure Log Extraction

In this blog post, we discussed the various methods for accessing and exporting Tenant and Subscription logs from Microsoft Azure.

July 16, 2023

So far in our blog post series on cloud log extraction, we have looked at extracting logs from AWS, Google Cloud, and Google Workspace. In the fourth installment of this series, we’ll be looking at how we can view and extract logs from Microsoft Azure.

In Azure, there are several sources of logs providing various information about your Azure tenant and its resources. Tenant logs (sign-in and audit logs) and Subscription logs (activity logs) are enabled by default. These logs can be accessed via the following methods, depending on the configuration:

  • Azure Portal
  • Log Analytics Workspace
  • Storage Account
  • Event Hub
  • Graph API

Resource, Operating System, and Application logs also exist but are off by default and will not be discussed in this blog post, although many of the concepts discussed will apply to the export methods for these log types too. Furthermore, configuring the log sources’ export settings is outside the scope of this blog post. We recommend reviewing Microsoft’s documentation on logging and diagnostic settings for more information, or check out SANS FOR509: Enterprise Cloud Forensics and Incident Response, in which we discuss this topic in detail. This blog post will focus on how these various access methods can be leveraged once the configuration is in place.

Azure Portal

The Azure Portal provides a quick and easy method of reviewing the Tenant and Subscription logs. Unfortunately, it will only provide logs from the last 30 days for Tenant logs (for enterprise customers) and the last 90 days for Subscription logs, so depending on your use case it may provide limited value. We’ll review how to view logs from both of these sources in the portal. The portal can be accessed via the following link: https://portal.azure.com/.

Starting with Tenant logs, within the Azure Portal, search for Azure Activity Directory and go to that service. On the navigation menu on the left, under Monitoring, there are two different log types that can be accessed from this view, Sign-in Logs and Audit Logs.

If accessing the sign-in logs, you’ll see a view similar to the one below:

From here, you can apply filters based on any of the fields available. Each of the tabs underneath the filter provide access to a list of sign-ins based on the type. Clicking on any of the rows will open a pane to the right containing all the details recorded for the event. If you wish to review outside of the portal, you can use the Download option at the top and export up to 100,000 rows per login type in CSV or JSON format. Alternatively, you can use the Export Data Settings to configure the logs to automatically forward to a Log Analytics Workspace, a storage account, or EventHub.

In a similar fashion, accessing the Audit logs will provide a table, filters, and download and export options, as show below:

The only difference here is that the download option will allow up to 250,000 events instead of 100,000 events.

The second log source available in the portal for viewing is the Subscription logs (more frequently referred to as activity logs). To view these logs, search for Activity log and access the service. You’ll once again be provided with a formatted table with filters available to search through the last 90 days of logs. Activity logs can only be downloaded in CSV format, not JSON.

A difference in how these events are represented versus the tenant logs is that each operation is made up of a series of events, as can be seen when expanding one of the operations.

This creates a challenge when trying to review the details of a large number of events. If desired, this data can be programmatically queried via the Get-Azlog PowerShell cmdlet or the az monitor activity-log CLI command.

Log Analytics Workspace

The next few methods discussed in this post are only relevant if configured via diagnostic settings in the Export Data Settings or Export Activity Logs options on the aforementioned views. We’ll start by looking at the Log Analytics Workspace.

One benefit of the Log Analytics Workspace is that we can send all of our logs, including resource, operating system, and application logs (if configured), to the same workspace, creating a central location for log access. To access your workspace, go to the same services mentioned above for Tenant or Subscription logs, but now select Log Analytics from the Monitoring section of the navigation pane (alternatively, you can search for Log Analytics Workspace in the Azure search bar). This will open up a view to run queries against the logs forwarded to that workspace, as shown in the screenshot below.

On the left, under LogManagement we can see the logs available for querying based on diagnostic setting configurations. In this case, we have access to audit logs, sign-in logs, and activity logs, plus some more. At the top of the page we can execute a query in Kusto Query Language (KQL). If you need some ideas for queries that can be run, simply select the Queries tab from the top of the left pane and choose a pre-built query to populate the search field with, then select Run.

Storage Accounts

Another export destination provided when configuring diagnostic settings is storage accounts. This method is great for being able to retain the logs for an extended period of time and export to a tool of your choice as needed. You’ll be charged for the data stored but can specify the retention period that meets your needs and budget. Once the logs are in the storage account, you can access them via API or via Azure Storage Explorer.

Inside the storage account, a JSON file will be created for each hour of activity with a directory structure indicating the date and hour that the log is related to. If you know the exact hour in which the activity you are looking for is, then you can go to that associated file and review. However, if you are trying to review activity across an extended time frame, this is not as simple. To combine these logs into a single file, we can use the following steps:

  1. Download all the blob containers via Azure Storage Explorer or using the following script: https://for509.com/blobpythonscript
  2. Concatenate the logs together with the following command:

find <path to logs> -type f –name PT1H.json  -exec cat {} + | tee <JSON filename>

  1. (Optionally) Import the combined JSON file into SOF-ELK by copying it ot the Azure Logstash folder with the following command:

    cp <JSON filename> /logstash/azure

This process will need to be repeated from the directories for each of the different types of sign-in logs.

Event Hub

We’re not going to go into depth on the usage of Event Hub in this blog post, but we will briefly mention it as a possibility for Event Hub is a service that provides real-time ingestion capable of processing significant amounts of data. Once data is in Event Hub, it can be accessed and read in a couple of ways. First, it can be integrated with supported third-party SIEMs, such as ArcSight, Splunk, or IBM QRadar. Second, its API can be used to develop custom tooling. To read more about leveraging Event Hub, view Microsoft’s documentation here: https://learn.microsoft.com/en-us/azure/active-directory/reports-monitoring/tutorial-azure-monitor-stream-logs-to-event-hub.

Graph API

The final method of retrieving logs worth mentioning is the Graph API. The Graph API has an endpoint for Azure AD activity reports that will provide access to the Tenant logs, both sign-in and audit logs. The documentation for this API endpoint can be found here: https://learn.microsoft.com/en-us/graph/api/resources/azure-ad-auditlog-overview?view=graph-rest-1.0

Unlike the aforementioned methods, this method is not configured or accessed directly via the portal and will require the user to develop custom code using one of the supported languages to perform the export as desired. This could be leveraged to simply download the logs to a file locally or to build an integration for a SIEM.

Open-Source Tools

Invictus IR and FOR509 course instructor Korstiaan Stamm have released an open-source tool called Microsoft Extractor Suite. As described in its documentation, this tool “is a fully-featured, actively-maintained, Powershell tool designed to streamline the process of collecting all necessary data and information from various sources within Microsoft.” It is able to extract the Azure AD sign-in logs and audit logs discussed in this article. It also has capabilities to extract the unified audit log (UAL), which we’ll discuss in the next blog post in this series. For more information on this project, check out the following links:

  • Blog Post
  • Github Repo
  • Documentation

This tool makes extracting logs much easier for those log sources supported by the tool, and it is definitely worth checking out as a tool to integrate into your processes.

Summary

In this blog post, we discussed the various methods for accessing and exporting Tenant and Subscription logs from Microsoft Azure. The quickest and simplest method, most useful for reviewing logs from within a recent time frame, is to access them via the Azure Portal directly. For longer retention times, diagnostic settings should be configured to export the logs to either a Log Analytics workspace, EventHub, or a Storage Account. Each of these destinations has strengths and weaknesses so it primarily depends on your use case and how you wish to use the data. Finally, if you wish to develop custom tooling, the logs are accessible via the Graph API. To close off this blog series, the next post will look at how we can export the Unified Audit Log (UAL) from Microsoft 365.

 

Share:
TwitterLinkedInFacebook
Copy url Url was copied to clipboard
Subscribe to SANS Newsletters
Receive curated news, vulnerabilities, & security awareness tips
United States
Canada
United Kingdom
Spain
Belgium
Denmark
Norway
Netherlands
Australia
India
Japan
Singapore
Afghanistan
Aland Islands
Albania
Algeria
American Samoa
Andorra
Angola
Anguilla
Antarctica
Antigua and Barbuda
Argentina
Armenia
Aruba
Austria
Azerbaijan
Bahamas
Bahrain
Bangladesh
Barbados
Belarus
Belize
Benin
Bermuda
Bhutan
Bolivia
Bonaire, Sint Eustatius, and Saba
Bosnia And Herzegovina
Botswana
Bouvet Island
Brazil
British Indian Ocean Territory
Brunei Darussalam
Bulgaria
Burkina Faso
Burundi
Cambodia
Cameroon
Cape Verde
Cayman Islands
Central African Republic
Chad
Chile
China
Christmas Island
Cocos (Keeling) Islands
Colombia
Comoros
Cook Islands
Costa Rica
Cote D'ivoire
Croatia (Local Name: Hrvatska)
Curacao
Cyprus
Czech Republic
Democratic Republic of the Congo
Djibouti
Dominica
Dominican Republic
East Timor
Ecuador
Egypt
El Salvador
Equatorial Guinea
Eritrea
Estonia
Eswatini
Ethiopia
Falkland Islands (Malvinas)
Faroe Islands
Fiji
Finland
France
French Guiana
French Polynesia
French Southern Territories
Gabon
Gambia
Georgia
Germany
Ghana
Gibraltar
Greece
Greenland
Grenada
Guadeloupe
Guam
Guatemala
Guernsey
Guinea
Guinea-Bissau
Guyana
Haiti
Heard And McDonald Islands
Honduras
Hong Kong
Hungary
Iceland
Indonesia
Iraq
Ireland
Isle of Man
Israel
Italy
Jamaica
Jersey
Jordan
Kazakhstan
Kenya
Kiribati
Korea, Republic Of
Kosovo
Kuwait
Kyrgyzstan
Lao People's Democratic Republic
Latvia
Lebanon
Lesotho
Liberia
Liechtenstein
Lithuania
Luxembourg
Macau
Madagascar
Malawi
Malaysia
Maldives
Mali
Malta
Marshall Islands
Martinique
Mauritania
Mauritius
Mayotte
Mexico
Micronesia, Federated States Of
Moldova, Republic Of
Monaco
Mongolia
Montenegro
Montserrat
Morocco
Mozambique
Myanmar
Namibia
Nauru
Nepal
Netherlands Antilles
New Caledonia
New Zealand
Nicaragua
Niger
Nigeria
Niue
Norfolk Island
North Macedonia
Northern Mariana Islands
Oman
Pakistan
Palau
Palestine
Panama
Papua New Guinea
Paraguay
Peru
Philippines
Pitcairn
Poland
Portugal
Puerto Rico
Qatar
Reunion
Romania
Russian Federation
Rwanda
Saint Bartholemy
Saint Kitts And Nevis
Saint Lucia
Saint Martin
Saint Vincent And The Grenadines
Samoa
San Marino
Sao Tome And Principe
Saudi Arabia
Senegal
Serbia
Seychelles
Sierra Leone
Sint Maarten
Slovakia
Slovenia
Solomon Islands
South Africa
South Georgia and the South Sandwich Islands
South Sudan
Sri Lanka
St. Helena
St. Pierre And Miquelon
Suriname
Svalbard And Jan Mayen Islands
Sweden
Switzerland
Taiwan
Tajikistan
Tanzania, United Republic Of
Thailand
Togo
Tokelau
Tonga
Trinidad And Tobago
Tunisia
Turkey
Turkmenistan
Turks And Caicos Islands
Tuvalu
Uganda
Ukraine
United Arab Emirates
United States Minor Outlying Islands
Uruguay
Uzbekistan
Vanuatu
Vatican City State
Venezuela
Vietnam
Virgin Islands (British)
Virgin Islands (U.S.)
Wallis And Futuna Islands
Western Sahara
Yemen
Zambia
Zimbabwe

By providing this information, you agree to the processing of your personal data by SANS as described in our Privacy Policy.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Tags:
  • Digital Forensics, Incident Response & Threat Hunting

Related Content

Blog
DFIR blog image.png
Digital Forensics, Incident Response & Threat Hunting
August 22, 2024
A Visual Summary of SANS DFIR Summit 2024
Check out these graphic recordings created in real-time throughout the event for SANS DFIR Summit 2024
No Headshot Available
Alison Kim
read more
Blog
FOR509.png
Digital Forensics, Incident Response & Threat Hunting
September 8, 2023
FOR509 – Always Evolving
With a significant amount of new content and labs in this release, it’s by far biggest update since last year
Megan_Roddie_370x370.png
Megan Roddie-Fonseca
read more
Blog
Cloud_Blog.png
Digital Forensics, Incident Response & Threat Hunting
September 4, 2023
Evolution of Cloud Tactics, Techniques, and Procedures
This blog post discussed techniques implemented across the kill chain, from initial access to lateral movement to impact.
Megan_Roddie_370x370.png
Megan Roddie-Fonseca
read more
  • Company
  • Mission
  • Instructors
  • About
  • FAQ
  • Press
  • Contact Us
  • Careers
  • Policies
  • Training Programs
  • Work Study
  • Academies & Scholarships
  • Public Sector Partnerships
  • Law Enforcement
  • SkillsFuture Singapore
  • Degree Programs
  • Get Involved
  • Join the Community
  • Become an Instructor
  • Become a Sponsor
  • Speak at a Summit
  • Join the CISO Network
  • Award Programs
  • Partner Portal
Subscribe to SANS Newsletters
Receive curated news, vulnerabilities, & security awareness tips
United States
Canada
United Kingdom
Spain
Belgium
Denmark
Norway
Netherlands
Australia
India
Japan
Singapore
Afghanistan
Aland Islands
Albania
Algeria
American Samoa
Andorra
Angola
Anguilla
Antarctica
Antigua and Barbuda
Argentina
Armenia
Aruba
Austria
Azerbaijan
Bahamas
Bahrain
Bangladesh
Barbados
Belarus
Belize
Benin
Bermuda
Bhutan
Bolivia
Bonaire, Sint Eustatius, and Saba
Bosnia And Herzegovina
Botswana
Bouvet Island
Brazil
British Indian Ocean Territory
Brunei Darussalam
Bulgaria
Burkina Faso
Burundi
Cambodia
Cameroon
Cape Verde
Cayman Islands
Central African Republic
Chad
Chile
China
Christmas Island
Cocos (Keeling) Islands
Colombia
Comoros
Cook Islands
Costa Rica
Cote D'ivoire
Croatia (Local Name: Hrvatska)
Curacao
Cyprus
Czech Republic
Democratic Republic of the Congo
Djibouti
Dominica
Dominican Republic
East Timor
Ecuador
Egypt
El Salvador
Equatorial Guinea
Eritrea
Estonia
Eswatini
Ethiopia
Falkland Islands (Malvinas)
Faroe Islands
Fiji
Finland
France
French Guiana
French Polynesia
French Southern Territories
Gabon
Gambia
Georgia
Germany
Ghana
Gibraltar
Greece
Greenland
Grenada
Guadeloupe
Guam
Guatemala
Guernsey
Guinea
Guinea-Bissau
Guyana
Haiti
Heard And McDonald Islands
Honduras
Hong Kong
Hungary
Iceland
Indonesia
Iraq
Ireland
Isle of Man
Israel
Italy
Jamaica
Jersey
Jordan
Kazakhstan
Kenya
Kiribati
Korea, Republic Of
Kosovo
Kuwait
Kyrgyzstan
Lao People's Democratic Republic
Latvia
Lebanon
Lesotho
Liberia
Liechtenstein
Lithuania
Luxembourg
Macau
Madagascar
Malawi
Malaysia
Maldives
Mali
Malta
Marshall Islands
Martinique
Mauritania
Mauritius
Mayotte
Mexico
Micronesia, Federated States Of
Moldova, Republic Of
Monaco
Mongolia
Montenegro
Montserrat
Morocco
Mozambique
Myanmar
Namibia
Nauru
Nepal
Netherlands Antilles
New Caledonia
New Zealand
Nicaragua
Niger
Nigeria
Niue
Norfolk Island
North Macedonia
Northern Mariana Islands
Oman
Pakistan
Palau
Palestine
Panama
Papua New Guinea
Paraguay
Peru
Philippines
Pitcairn
Poland
Portugal
Puerto Rico
Qatar
Reunion
Romania
Russian Federation
Rwanda
Saint Bartholemy
Saint Kitts And Nevis
Saint Lucia
Saint Martin
Saint Vincent And The Grenadines
Samoa
San Marino
Sao Tome And Principe
Saudi Arabia
Senegal
Serbia
Seychelles
Sierra Leone
Sint Maarten
Slovakia
Slovenia
Solomon Islands
South Africa
South Georgia and the South Sandwich Islands
South Sudan
Sri Lanka
St. Helena
St. Pierre And Miquelon
Suriname
Svalbard And Jan Mayen Islands
Sweden
Switzerland
Taiwan
Tajikistan
Tanzania, United Republic Of
Thailand
Togo
Tokelau
Tonga
Trinidad And Tobago
Tunisia
Turkey
Turkmenistan
Turks And Caicos Islands
Tuvalu
Uganda
Ukraine
United Arab Emirates
United States Minor Outlying Islands
Uruguay
Uzbekistan
Vanuatu
Vatican City State
Venezuela
Vietnam
Virgin Islands (British)
Virgin Islands (U.S.)
Wallis And Futuna Islands
Western Sahara
Yemen
Zambia
Zimbabwe

By providing this information, you agree to the processing of your personal data by SANS as described in our Privacy Policy.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
  • Privacy Policy
  • Terms and Conditions
  • Do Not Sell/Share My Personal Information
  • Contact
  • Careers
© 2025 The Escal Institute of Advanced Technologies, Inc. d/b/a SANS Institute. Our Terms and Conditions detail our trademark and copyright rights. Any unauthorized use is expressly prohibited.
  • Twitter
  • Facebook
  • Youtube
  • LinkedIn