-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #155 from T0pCyber/navarrodev
Navarrodev
- Loading branch information
Showing
21 changed files
with
143 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
�� |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
Function Get-HawkTenantAuditLog{ | ||
<# | ||
.SYNOPSIS | ||
Retrieves all Azure AD audit logs for a specified tenant and exports them to a CSV file. | ||
.DESCRIPTION | ||
The Get-HawkTenantAuditLogs function retrieves all Azure AD audit logs for a specified tenant using the Microsoft Graph API. The audit logs are then exported to a CSV file using the Out-MultipleFileType function from the Hawk module. | ||
.EXAMPLE | ||
PS C:\> Get-HawkTenantAuditLogs | ||
This example retrieves all Azure AD audit logs for the "contoso.onmicrosoft.com" tenant and exports them to a CSV file. | ||
.NOTES | ||
This function requires the Microsoft Graph PowerShell module and the Hawk module to be installed. You can install these modules using the following commands: | ||
Install-Module -Name Microsoft.Graph | ||
Install-Module -Name Hawk | ||
.LINK | ||
https://docs.microsoft.com/en-us/graph/api/resources/auditlog?view=graph-rest-1.0 | ||
#> | ||
BEGIN{ | ||
#Initializing Hawk Object if not present | ||
if ([string]::IsNullOrEmpty($Hawk.FilePath)) { | ||
Initialize-HawkGlobalObject | ||
} | ||
Out-LogFile "Gathering Azure AD Audit Logs events" | ||
} | ||
PROCESS{ | ||
$auditLogsResponse = Get-MgAuditLogDirectoryAudit -All | ||
foreach ($auditLog in $auditLogsResponse) { | ||
$auditLogs += [PSCustomObject]@{ | ||
Id = $auditLog.Id | ||
Category = $auditLog.Category | ||
Result = $auditLog.Result | ||
ResultReason = $auditLog.ResultReason | ||
ActivityDisplayName = $auditLog.ActivityDisplayName | ||
ActivityDateTime = $auditLog.ActivityDateTime | ||
Target = $auditLog.TargetResources[0].DisplayName | ||
Type = $auditLog.Target.TargetResources[0].Type | ||
UserPrincipalName = $auditLog.TargetResources[0].UserPrincipalName | ||
UserType = $auditLog.UserType | ||
} | ||
} | ||
} | ||
END{ | ||
$auditLogs | Sort-Object -Property ActivityDateTime | Out-MultipleFileType -FilePrefix "AzureADAuditLog" -csv -json | ||
Out-Logfile "Completed exporting Azure AD audit logs" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.