Retrieves log events from Azure resources.
Get-AzLog
[-ResourceGroup string]
[-ResourceId string]
[-StartTime DateTime]
[-EndTime DateTime]
[-OperationName string]
[-Caller string]
[-SubscriptionId string]
[-DefaultProfile IAzureContextContainer]
[-Force]
[-AsJob]
[-WhatIf]
[-Confirm]
The Get-AzLog cmdlet retrieves log events from Azure resources. This cmdlet is useful for monitoring and auditing the activities performed on your Azure resources.
string
string
DateTime
DateTime
string
string
string
IAzureContextContainer
switch
switch
switch
switch
None
Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels.AzureLog
The cmdlet outputs an object that represents a log event, containing properties such as:
Level: The severity level of the log event (e.g., 'Informational', 'Warning', 'Error').OperationName: The name of the operation performed.Caller: The principal that performed the operation.ResourceId: The ID of the resource affected by the operation.TimeGenerated: The timestamp when the log event was generated.Properties: Additional details about the event.This command retrieves all log events for the resource group named "MyResourceGroup".
Get-AzLog -ResourceGroup "MyResourceGroup"
This command retrieves log events for a specific resource ID between 2023-10-26 09:00:00 and 2023-10-26 17:00:00.
Get-AzLog -ResourceId "/subscriptions/YOUR_SUBSCRIPTION_ID/resourceGroups/MyResourceGroup/providers/Microsoft.Web/sites/MyWebApp" `
-StartTime "2023-10-26T09:00:00Z" -EndTime "2023-10-26T17:00:00Z"
This command retrieves all log events related to the 'Microsoft.Compute/virtualMachines/start/action' operation within your subscription.
Get-AzLog -OperationName "Microsoft.Compute/virtualMachines/start/action"