Quark Soup
Quark Soup

Reputation: 4741

How do I get rid of Azure Powershell warning "WARNING: AzureVM A property of the output of this cmdlet will change in an upcoming..."

I have some old Azure Powershell scripts that I'm breaking out of mothballs to use again. They seem to work as I remember them, except I'm getting these warnings:

$VirtualMachine = Add-AzureRmVMNetworkInterface -VM $VirtualMachine -Id $nic.Id

WARNING: Add-AzureRmVMNetworkInterface: A property of the output of this cmdlet will change in an upcoming breaking change release. The Name property for a Sku will return Standard_LRS and Premium_LRS

$vm = Set-AzureRmVMBootDiagnostics -VM $VirtualMachine -Disable

WARNING: Set-AzureRmVMBootDiagnostics: A property of the output of this cmdlet will change in an upcoming breaking change release. The StorageAccountType property for a DataDisk will return Standard_LRS and Premium_LRS

I'm not using any of the output in my scripts so the warnings are useless. There's a lot of output in these scripts and I only want to see stuff that really concerns the health of the script and the objects created.

Upvotes: 0

Views: 3245

Answers (3)

Bill Menees
Bill Menees

Reputation: 2464

In early 2023, Microsoft changed things again. Now, the https://aka.ms/azps-changewarnings docs say to use:

Update-AzConfig -DisplayBreakingChangeWarning $false

# Or use this to avoid pushing the result into PS's output pipeline
[void](Update-AzConfig -DisplayBreakingChangeWarning $false)

Those docs still link to another page that says you can use an environment variable as an alternative:

Set-Item Env:\SuppressAzurePowerShellBreakingChangeWarnings "true"

However, that environment variable stopped working for me.

Upvotes: 4

Damien Caro
Damien Caro

Reputation: 70

You can suppress the breaking change warning with the following environment variable:

Set-Item Env:\SuppressAzurePowerShellBreakingChangeWarnings "true"

More information here: https://github.com/Azure/azure-powershell/blob/master/documentation/breaking-changes/breaking-changes-messages-help.md

Upvotes: 2

KrishnaG
KrishnaG

Reputation: 3484

Ideally you can use '-WarningAction 0' parameter in your command to supress warning messages. Hope this helps!

Upvotes: -1

Related Questions