Search code examples
azurepowershellloggingazure-powershellflags

Supress logs while running Azure Powershell commands


I an running Azure Powershell commands where I will be adding the Network rules to storage account, diagnostic logs storage account and Keyvault and I am using the following Azure commands.

  • Add-AzStorageAccountNetworkRule
  • Add-AzKeyVaultNetworkRule

And I am getting lots of logs while executing this in my powershell. Not only these commands, but most of the Azure commands will output some logs into the powershell console, the above two are just examples.

I want to know if there is any flag that we can add at the end of the Azure powershell commands so that it won't output any logs or output minimal logs into the powershell console.


Solution

  • Thank you @Gaurav Mantri, For the last blog you posted. its gave the output as per op's requirement for the logs. Posting it as an answer to beneficial for other community members.

    We have also tried the same using the blog to see the logs if its appear or not using pipeline with | Out-Null and can able to not getting any logs for this. Also there are another 3 ways as mentioned in that blog.

    We have tried with below cmdlts:-

    Add-AzStorageAccountNetworkRule -ResourceGroupName "rgname" -Name "cloudtest*****" -IPAddressOrRange "10.0.0.0/7","28.2.0.0/16" |Out-Null
    

    PLEASE CHECK MY OUTPUT SCREENSHOT FOR REFERENCE:-

    enter image description here enter image description here