diff --git a/src/ResourceManagement/ContainerInstance/ContainerGroupImpl.cs b/src/ResourceManagement/ContainerInstance/ContainerGroupImpl.cs index 05f0d2873..a5cb42ea9 100644 --- a/src/ResourceManagement/ContainerInstance/ContainerGroupImpl.cs +++ b/src/ResourceManagement/ContainerInstance/ContainerGroupImpl.cs @@ -612,11 +612,10 @@ public IDnsConfigFork WithNetworkProfileId(string subscriptionId, string resourc ContainerGroupNetworkProfile containerGroupNetworkProfile = new ContainerGroupNetworkProfile(); containerGroupNetworkProfile.Id = networkProfileId; this.Inner.NetworkProfile = containerGroupNetworkProfile; - if (this.Inner.IpAddress == null) + if (this.Inner.IpAddress != null) { - this.Inner.IpAddress = new IpAddress(); + this.Inner.IpAddress.Type = ContainerGroupIpAddressType.Private.ToString(); } - this.Inner.IpAddress.Type = ContainerGroupIpAddressType.Private.ToString(); return this; }