From edc5d882465fa77c27d5f9814510dba9bdf2bfb9 Mon Sep 17 00:00:00 2001 From: Weidong Xu Date: Wed, 29 Sep 2021 10:12:18 +0800 Subject: [PATCH] fix no ports in container group (#1276) --- .../ContainerInstance/ContainerGroupImpl.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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; }