public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var gatewayIpConfiguration = this.ApplicationGateway.GatewayIpConfigurations.SingleOrDefault (resource => string.Equals(resource.Name, this.Name, System.StringComparison.CurrentCultureIgnoreCase)); if (gatewayIpConfiguration == null) { throw new ArgumentException("Application gateway IP configuration with the specified name does not exist"); } gatewayIpConfiguration = new PSApplicationGatewayIpConfiguration(); gatewayIpConfiguration.Name = this.Name; var gatewayIpConfig = new PSResourceId(); gatewayIpConfig.Id = this.Subnet; gatewayIpConfiguration.Subnet = gatewayIpConfig; gatewayIpConfiguration.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayIpConfigurationName, this.Name); this.ApplicationGateway.GatewayIpConfigurations.Add(gatewayIpConfiguration); WriteObject(this.ApplicationGateway); }
public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var gatewayIpConfiguration = new PSApplicationGatewayIpConfiguration(); gatewayIpConfiguration.Name = this.Name; var gatewayIpConfig = new PSResourceId(); gatewayIpConfig.Id = this.Subnet; gatewayIpConfiguration.Subnet = gatewayIpConfig; gatewayIpConfiguration.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId( this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId, Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayIpConfigurationName, this.Name); WriteObject(gatewayIpConfiguration); }