New-AzPublicIpAddress and -zone = {} #20141
-
With the upcoming New-AzPubLicIpAddress wanting a "-Zone =" argument for a "-SKU = Standard" but blows up if you include it in a "Basic" SKU is it possible to so something like: I would like to pass an argument as a variable something like: If ($SKU -eq "Basic") { $PIP = NewPublicIpAddress Thanks much |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@chillyjim What you are looking for is called splatting where you can pass an object or array parameters to a cmdlet. So, for your case, it would be something like this $z = {}
If ($SKU -neq "Basic") {
$z.Zone = {}
}
$PIP = NewPublicIpAddress -Name "$VmName-pip-$i"
-ResourceGroupName $vmInfo.ResourceGroupName -Location $vmInfo.Location
-AllocationMethod Static `
-sku $SKU @z |
Beta Was this translation helpful? Give feedback.
@chillyjim What you are looking for is called splatting where you can pass an object or array parameters to a cmdlet.
So, for your case, it would be something like this