Home > Software design >  Log Analytics workspace - Alerts to list
Log Analytics workspace - Alerts to list

Time:01-17

Alerts can be listed like that with az cli like that

$activities = az monitor activity-log list -g $ResourceGroup

which produces in PowerShell a string but is a list of JSON's.

Any one knows why $activities is not a PSCustomObject which I could use ?

CodePudding user response:

I do agree with @Mathias R. Jessen that

az is an executable and executables return strings, not objects

$activities = az monitor activity-log list -g "Resourcegroup"
$res=$activities | ConvertFrom-Json                              
$res

Output:

enter image description here

Now you can use Dot Operator as below:

enter image description here

  • Related