Open
Description
Description
When no subnet is provided, New-AzNetworkInterfaceIpConfig
simply ignores the -PrivateIpAddress
parameter. There's no error message, it's simply not applied. However, any requirement to to ensure a subnet is specified when setting a private IP can be easily circumvented by setting the field after the fact:
$cfg=New-AzNetworkInterfaceIpConfig -Name 'myconfig' -PrivateIpAddress '10.0.6.66'
# Private IP not set here.
$cfg.PrivateIpAddress='10.0.6.66'
# But now it is
If IP address must not be set without a subnet present, then conditional logic needs to be able to the setter of Microsoft.Azure.Commands.Network.Models.PSNetworkInterfaceIPConfiguration
to enforce this constraint. If not, then it should not be disregarded in New-AzNetworkInterfaceIpConfig
.
Steps to reproduce
See above
Environment data
Name Value
---- -----
PSVersion 6.2.3
PSEdition Core
GitCommitId 6.2.3
OS Microsoft Windows 10.0.18363
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Module versions
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 1.15.0 Az.Network {Add-AzApplicationGatewayAuthenticationCertificate, Ad…