Azure automation Runbook loads all modules and shows them in "All logs"

Bombbe 1,621 Reputation points
2020-11-11T08:46:54.077+00:00

Hi,
when running Azure automation Powershell Runbook it importing all modules and are logging them to "All logs". That means that important logs are lost in to mass. As you can see in this picture what am I talking about and there is about 200 rows of that.

38899-importing-cmdlet.png

Is there way to get lose of those so important logs are not lost in to mass? In the runbook i'm not importing any Powershell modules. I'm only using commands like Get-AzVM -ResourceGroupName $vm.ResourceGroupName -Name $vm.Name -Status).Statuses.DisplayStatus[-1] or Get-AzVMExtension -ResourceGroupName $vm.ResourceGroupName -VMName $vm.Name -Name 'NetworkWatcherAgentLinux' -ErrorAction SilentlyContinue

If I remeber correctly this started when I upgated Runbook from RM -> AZ

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,193 questions
0 comments No comments
{count} votes

Accepted answer
  1. tbgangav-MSFT 10,421 Reputation points
    2020-11-12T08:51:33.14+00:00

    Hi @Bombbe ,

    I was able to reproduce your experience. As explained in this Azure document, Verbose information is written to job history only if verbose logging is turned on for the runbook. For illustration, check highlighted part of the below screenshot1. Turn off the verbose logging and then you will get rid of the verbose information.

    • Screenshot-1:
      39311-image.png
    • All logs with verbose logging turned on:
      39190-image.png
    • All logs with verbose logging turned off:
      39313-image.png
    • Published runbook executed to see above output: $ServicePrincipalConnection = Get-AutomationConnection -Name 'AzureRunAsConnection'
      Add-AzAccount -ServicePrincipal -TenantId $ServicePrincipalConnection.TenantId -ApplicationId $ServicePrincipalConnection.ApplicationId -CertificateThumbprint $ServicePrincipalConnection.CertificateThumbprint
      $rgname ="Management_Migration-Resources"
      $vmname ="MM-VM-Win-2019"
      (Get-AzVM -ResourceGroupName $rgname -Name $vmname -Status).Statuses.DisplayStatus[-1]
      39321-image.png
    • Note: To try above runbook, make sure you replace value of $rgname and $vmname with your resource group name and virtual machine name as appropriate.

0 additional answers

Sort by: Most helpful