Forum Discussion
shmoolya
May 14, 2020Copper Contributor
How to retrieve Azure Log Activity Data using python for any resource alongwith 'Tags'?
My colleague used the below powershell query to retrieve log data for past 4 days excluding today which matches operations of the resources and collects features such as EventTimeStamp, Caller, SubscriptionId etc.
Get-AzureRmLog -StartTime (Get-Date).AddDays(-4) -EndTime (Get-Date).AddDays(-1) | Where-Object {$_.OperationName.LocalizedValue -match "Start|Stop|Restart|Create|Update|Delete"} |
Select-Object EventTimeStamp, Caller, SubscriptionId, @{name="Operation"; Expression = {$_.operationname.LocalizedValue}},
I am a newbie to azure and want to generate a report where I can also fetch the 'Tags' name & value against a resource for past 90 days in this report. What will be the powershell query for this? Can I also use python to query this data? I tried searching the documentation and was unable to dig into it, so if anybody could redirect me to the right place it will be helpful.
- CliveWatson
Microsoft
Hello and welcome shmoolya
There is a dedicated PowerShell group, that maybe a better place to ask and get help from https://techcommunity.microsoft.com/t5/powershell/ct-p/WindowsPowerShell
Thanks
- shmoolyaCopper ContributorI cannot start a conversation there due to insufficient privileges. And this question also asks azure support with python