Get-AzActivityLog

In this Azure PowerShell article, we will discuss the syntax and usage of the Get-AzActivityLog PowerShell command with certain examples.

Get-AzActivityLog

This Azure PowerShell command can help you retrieve the lists of Activity Log events from your Azure Subscription.

Syntax of Get-AzActivityLog

Below is the syntax of the Get-AzActivityLog PowerShell command.

Get-AzActivityLog
Get-AzActivityLog [-MaxRecord <Int32>]
Get-AzActivityLog
 [-StartTime <DateTime>]
Get-AzActivityLog
 [-StartTime <DateTime>]
 [-EndTime <DateTime>]
Get-AzActivityLog [-CorrelationId] <String>

Get-AzActivityLog Examples

Let’s discuss a few examples of how to use the Get-AzActivityLog PowerShell command.

Example – 1

You can execute the below Azure PowerShell command to get the complete lists of Activity Log events from your Azure Subscription.

Get-AzActivityLog

After executing the above command, I got the below output

Get-AzActivityLog

Note that the output above is not the complete output, as the actual output is lengthy.

Example-2

You can also execute the below Azure PowerShell command to get an event log list with the specified maximum number of events, i.e., 2.

Get-AzActivityLog -MaxRecord 2

After executing the above command, I got the expected output as below

Authorization        : 
Claims               : 
                       http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress: AcmClient@microsoft.com
HttpRequest          : 
Properties           : 
                       title          : PIR - Azure Network Infrastructure - Intermittent failures
                       service        : Network Infrastructure
                       region         : Central US
                       communication  : <p><strong>Summary of Impact</strong>: Between 15:12 UTC and 22:00 UTC on 18 Sep 2023, you were identified as 
                       a customer using Azure Network Infrastructure in Central US who may have experienced intermittent impact when trying to 
                       establish connection. However, retrying the connection was successful and helped minimize the impact of these issues.</p>
                       <p><br></p>
                       <p><strong>Root Cause</strong>: We determined that third party construction between two Microsoft’s datacenter impacted fiber 
                       links. This in turn, led to the intermittent impact mentioned above.</p>
                       <p><br></p>
                       <p><strong>Mitigation</strong>: The platform achieved stability through automatic healing and retry mechanisms, ensuring that 
                       customers remained unaffected.</p>
                       <p><br></p>
                       <p>Stay informed about Azure service issues by creating custom service health alerts: https://aka.ms/ash-videos for video 
                       tutorials and https://aka.ms/ash-alerts for how-to documentation.</p>
                       incidentType   : Incident
                       trackingId     : 2VT5-DCG
                       impactStartTime: 9/18/2023 3:12:00 PM
                       impactMitigationTime: 9/18/2023 10:00:00 PM
                       impactedServices: [{"ImpactedRegions":[{"RegionName":"Central US","RegionId":"centralus"}],"ServiceName":"Network 
                       Infrastructure","ServiceId":"networkinfrastructure"}]
                       impactedServicesTableRows: <tr>
                       <td align='center' style='padding: 5px 10px; border-right:1px solid black; border-bottom:1px solid black'>Network 
                       Infrastructure</td>
                       <td align='center' style='padding: 5px 10px; border-bottom:1px solid black'>Central US<br></td>
                       </tr>
                       
                       defaultLanguageTitle: PIR - Azure Network Infrastructure - Intermittent 
Level                : Informational
SubmissionTimestamp  : 18-09-2023 22:35:11
EventTimestamp       : 18-09-2023 22:35:11
EventName            : 
Category             : Service Health
ResourceProviderName : 
OperationName        : Microsoft.ServiceHealth/incident/action
Status               : Resolved
SubStatus            : 
Caller               : AcmClient@microsoft.com
Description          : Resolved: PIR - Azure Network Infrastructure - Intermittent failures
Id                   : /subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/events/0fe9fca8-8bed-34aa-f89b-3b02ac4433fd/ticks/638306733113305250
EventDataId          : 0fe9fca8-8bed-34aa-f89b-3b02ac4433fd
CorrelationId        : 4e60d7ab-a8eb-49dd-ac57-23e5feb5d1d7
ResourceGroupName    : 
ResourceId           : /subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1
ResourceType         : 
OperationId          : 
SubscriptionId       : 1cdf4300-dee5-4518-9c9c-feaa72a5cbd1
TenantId             : 

Authorization        : 
Claims               : 
                       http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress: AcmClient@microsoft.com
HttpRequest          : 
Properties           : 
                       title          : Azure Network Infrastructure - Central US - Mitigated
                       service        : Network Infrastructure
                       region         : Central US
                       communication  : <p><strong>Summary of Impact</strong>: Between 15:12 UTC and 22:00 UTC on 18 Sep 2023, you were identified as 
                       a customer using Azure Network Infrastructure in Central US who may have experienced intermittent failures when trying to 
                       establish connection. However, retrying the connection was successful and helped minimize the impact of these issues.</p>
                       <p><br></p>
                       <p><strong>Current Status</strong>: The incident is now mitigated. More information will be provided shortly.</p>
                       incidentType   : Incident
                       trackingId     : 2VT5-DCG
                       impactStartTime: 9/18/2023 3:12:00 PM
                       impactMitigationTime: 9/18/2023 10:00:00 PM
                       impactedServices: [{"ImpactedRegions":[{"RegionName":"Central US","RegionId":"centralus"}],"ServiceName":"Network 
                       Infrastructure","ServiceId":"networkinfrastructure"}]
                       impactedServicesTableRows: <tr>
                       <td align='center' style='padding: 5px 10px; border-right:1px solid black; border-bottom:1px solid black'>Network 
                       Infrastructure</td>
                       <td align='center' style='padding: 5px 10px; border-bottom:1px solid black'>Central US<br></td>
                       </tr>
                       
                       defaultLanguageTitle: Azure Network Infrastructure - Central US - 
Level                : Informational
SubmissionTimestamp  : 18-09-2023 22:12:48
EventTimestamp       : 18-09-2023 22:12:48
EventName            : 
Category             : Service Health
ResourceProviderName : 
OperationName        : Microsoft.ServiceHealth/incident/action
Status               : Resolved
SubStatus            : 
Caller               : AcmClient@microsoft.com
Description          : Resolved: Azure Network Infrastructure - Central US - Mitigated
Id                   : /subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1/events/1c2ed510-0863-172d-8c61-d33cc6218de2/ticks/638306719685087018
EventDataId          : 1c2ed510-0863-172d-8c61-d33cc6218de2
CorrelationId        : fc31d857-4271-404d-ae8a-66c48aacf505
ResourceGroupName    : 
ResourceId           : /subscriptions/1cdf4300-dee5-4518-9c9c-feaa72a5cbd1
ResourceType         : 
OperationId          : 
SubscriptionId       : 1cdf4300-dee5-4518-9c9c-feaa72a5cbd1
TenantId             : 

You can see the same output below

Get-AzActivityLog PowerShell

Example-3

You can also execute the below Azure PowerShell command to get an event log list with the specified start time.

Get-AzActivityLog -StartTime 2023-09-01T10:30

After executing the above PowerShell command, I got the below-expected output

Get-AzActivityLog -StartTime

Get-AzActivityLog PowerShell – Video Tutorial

Wrapping Up

In this Azure article, we discussed the syntax and usage of the Get-AzActivityLog PowerShell command with certain examples. Thanks for reading this article !!!