Skip to content

New-AzPublicIpAddress and -zone = {} #20141

Discussion options

You must be logged in to vote

@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

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dingmeng-xue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants