Problem with Get-AzureRmLog. Caller information is not displayed.
Cmdlet
Get-AzureRmLog
PowerShell Version
5.0.10586.117
Module Version
4.3.1 (Although I have other versions coexist in the box)
OS Version
10.0.10586.117
Description
I used to get the user who initiated a event when I query Get-AzureRmLog cmdlet. But, since yesterday, we observe that we are not getting the user information in the event.
Debug Output
Scrubbed version.
{
"authorization": {
"action": "Microsoft.Compute/virtualMachines/extensions/write",
"scope": "/subscriptions/
Script/Steps for Reproduction
Code that I am using
$ActivityLog = Get-AzureRmLog -StartTime ([DateTime]::Now - [TimeSpan]::FromHours(24)) -EndTime ([DateTime]::Now)
$VMCreateLog = $ActivityLog | Where-Object {$_.Authorization.Action -eq 'Microsoft.Compute/VirtualMachines/write'}
After initialization of the $VMCreateLog, I've set a breakpoint to observe the records and below is a sample.
@gucalder Hey Guillermo, would you mind taking a look at this issue? It looks like the property in question is still available from the output, but it is not being populated.
@karun-r what was the previous version you were using that was returning a value for the Caller property?
@cormacpayne It should be the same version as I didn't do any update to the modules in a month. This cmdlet was working as expected till a couple of days back.
And one more quick thing @cormacpayne , you mentioned in our previous comment that the value for caller is available from the output but I'm just puzzled on where you saw that in the debug output? Did you run the cmdlet it on any of the subscription available to you or is there any other source for this that I am missing? Would you mind sharing some light on that?
@karun-r in both the picture you posted above and my execution of Get-AzureRmLog, there is a Caller property that is in the output (part of the object returned) that has no value.
PS C:\> $logs = Get-AzureRmLog
PS C:\> $logs[0]
Authorization :
Caller :
CorrelationId : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Category : ServiceHealth
EventTimestamp : 10/20/2017 1:17:34 AM
OperationName : RCA - Azure Management Portal [Multi-Region]
ResourceGroupName :
ResourceId :
Status : Resolved
SubscriptionId : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx
SubStatus :
PS C:\> $logs[0].GetType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False PSEventDataNoDetails System.Object
I also found the type of the returned object is PSEventDataNoDetails (which can be seen above), and I found that it has a Caller property.
Oh, I got it wrong then. I thought you meant that data was available for Caller property but it was not being displayed in the output.
@karun-r ah sorry, I meant that the property is still available to access, but it is not being populated with any value
No problem, and on further troubleshooting, I observed that this is happening only for events that have Authorization.Action set to 'Microsoft.Compute/VirtualMachines/write'. For delete events, I am able to see the value in caller property. That is,
Caller value is null.
$ActivityLog | Where-Object {$_.Authorization.Action -eq 'Microsoft.Compute/VirtualMachines/write'}
Caller value is not null.
$ActivityLog | Where-Object {$_.Authorization.Action -eq 'Microsoft.Compute/VirtualMachines/delete'}
Donno if this helps.
Is there any update on this issue ? Status is still same even after a month. This is happening only for some kind of events as I stated.
@gucalder ping
You may have to weed out service health events by adding | Where {$_.Category -ne 'ServiceHealth'} as the have no Caller
Not every record in Activity Logs will have caller property. Typically the caller property is only available for records in Activity Logs which are generated in category 'Administrative' by Azure Resource Manager. Additionally, the caller property is a virtual property which is computed from the information in the Claims property (emailaddress/upn/spn) of the record. If you are seeing missing data in the Claims property for specific records in the Activity Logs, the best way to follow up is to open a support ticket and we can follow up with the appropriate Azure team.