How to hide warnings from Azure powershell command lets
You could try -WarningAction Ignore
, but if that doesn't work, you can redirect the warning stream, which is stream 3, to $null
(or to wherever you want):
New-AzureStorageAccount -StorageAccountName $storageName 3> $null# Left out other parameters for readability
Note that -Verbose:$false
will affect verbose messages, not warnings, which are a different stream.
Also note that this requires Powershell 3+:
The All (*), Warning (3), Verbose (4) and Debug (5) redirection operators were introduced in Windows PowerShell 3.0. They do not work in earlier versions of Windows PowerShell.
I have exactly the same problem before and solve this by the follow:
New-AzureStorageAccount ... | Out-Null