Skip to content

Inconsistent behavior with the PrivateIpAddress parameter on New-AzNetworkInterfaceIpConfig #10650

Open
@yevster

Description

@yevster

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… 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Network - Virtual NetworkService AttentionThis issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions