Created
April 29, 2021 11:13
-
-
Save nichollsc81/2c3627a5c7aad39c60580702323ec377 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 code parse the audit logs exported from azure devops and saved as file auditlog.json | |
function Parse-AzureDevOpsAuditLogs { | |
[CmdletBinding()] | |
Param( | |
[Parameter(Mandatory=$true)] | |
[ValidateNotNullOrEmpty()] | |
[string] $Path | |
) | |
Begin { | |
Write-Verbose "In Begin Block: Parse-AzureDevOpsAuditLogs" | |
} | |
Process{ | |
Write-Verbose "In Process Block: Parse-AzureDevOpsAuditLogs" | |
if (!(Test-Path $Path)){ | |
Write-Host "The mentioned file: $Path not found." | |
return | |
} | |
$auditLogs = Get-Content –Path $Path | ConvertFrom-Json | |
Write-Host "Timestamp `t ScopeType `t ProjectName `t IpAddress `t Details `t Area `t CategoryDisplayName" | |
foreach($auditlog in $auditLogs){ | |
Write-Host "$($auditLog.Timestamp) `t $($auditLog.ScopeType) `t $($auditLog.ProjectName) `t $($auditLog.IpAddress) `t $($auditLog.Details) `t $($auditLog.Area) `t $($auditLog.CategoryDisplayName)" | |
} | |
} | |
End { | |
Write-Verbose "In End Block: Parse-AzureDevOpsAuditLogs" | |
} | |
} | |
#Parse-AzureDevOpsAuditLogs –Path .\auditLog.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment