protected override void ProcessRecord()
        {
            // VirtualMachineProfile
            if (this.VirtualMachineScaleSet.VirtualMachineProfile == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVMProfile();
            }

            // NetworkProfile
            if (this.VirtualMachineScaleSet.VirtualMachineProfile.NetworkProfile == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile.NetworkProfile = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetNetworkProfile();
            }

            // NetworkInterfaceConfigurations
            if (this.VirtualMachineScaleSet.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations = new List <Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetNetworkConfiguration>();
            }

            var vNetworkInterfaceConfigurations = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetNetworkConfiguration();

            vNetworkInterfaceConfigurations.Name             = this.Name;
            vNetworkInterfaceConfigurations.Primary          = this.Primary;
            vNetworkInterfaceConfigurations.Id               = this.Id;
            vNetworkInterfaceConfigurations.IpConfigurations = this.IpConfiguration;
            this.VirtualMachineScaleSet.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations.Add(vNetworkInterfaceConfigurations);
            WriteObject(this.VirtualMachineScaleSet);
        }
        protected override void ProcessRecord()
        {
            // VirtualMachineProfile
            if (this.VirtualMachineScaleSet.VirtualMachineProfile == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVMProfile();
            }

            // NetworkProfile
            if (this.VirtualMachineScaleSet.VirtualMachineProfile.NetworkProfile == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile.NetworkProfile = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetNetworkProfile();
            }

            // NetworkInterfaceConfigurations
            if (this.VirtualMachineScaleSet.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations = new List<Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetNetworkConfiguration>();
            }

            var vNetworkInterfaceConfigurations = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetNetworkConfiguration();

            vNetworkInterfaceConfigurations.Name = this.Name;
            vNetworkInterfaceConfigurations.Primary = this.Primary;
            vNetworkInterfaceConfigurations.Id = this.Id;
            vNetworkInterfaceConfigurations.IpConfigurations = this.IpConfiguration;
            this.VirtualMachineScaleSet.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations.Add(vNetworkInterfaceConfigurations);
            WriteObject(this.VirtualMachineScaleSet);
        }
        private void Run()
        {
            WriteWarning("Add-AzureRmVmssNetworkInterfaceConfiguration: A property of the output of this cmdlet will change in an upcoming breaking change release. " +
                         "The StorageAccountType property for a DataDisk will return Standard_LRS and Premium_LRS");

            // VirtualMachineProfile
            if (this.VirtualMachineScaleSet.VirtualMachineProfile == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVMProfile();
            }

            // NetworkProfile
            if (this.VirtualMachineScaleSet.VirtualMachineProfile.NetworkProfile == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile.NetworkProfile = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetNetworkProfile();
            }

            // NetworkInterfaceConfigurations
            if (this.VirtualMachineScaleSet.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations = new List <Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetNetworkConfiguration>();
            }

            var vNetworkInterfaceConfigurations = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetNetworkConfiguration();

            vNetworkInterfaceConfigurations.Name    = this.MyInvocation.BoundParameters.ContainsKey("Name") ? this.Name : null;
            vNetworkInterfaceConfigurations.Primary = this.MyInvocation.BoundParameters.ContainsKey("Primary") ? this.Primary : (bool?)null;
            vNetworkInterfaceConfigurations.EnableAcceleratedNetworking = this.EnableAcceleratedNetworking.IsPresent;
            vNetworkInterfaceConfigurations.EnableIPForwarding          = this.EnableIPForwarding.IsPresent;
            vNetworkInterfaceConfigurations.Id = this.MyInvocation.BoundParameters.ContainsKey("Id") ? this.Id : null;
            if (this.MyInvocation.BoundParameters.ContainsKey("NetworkSecurityGroupId"))
            {
                // NetworkSecurityGroup
                vNetworkInterfaceConfigurations.NetworkSecurityGroup    = new Microsoft.Azure.Management.Compute.Models.SubResource();
                vNetworkInterfaceConfigurations.NetworkSecurityGroup.Id = this.NetworkSecurityGroupId;
            }
            if (this.MyInvocation.BoundParameters.ContainsKey("DnsSettingsDnsServer"))
            {
                // DnsSettings
                vNetworkInterfaceConfigurations.DnsSettings            = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetNetworkConfigurationDnsSettings();
                vNetworkInterfaceConfigurations.DnsSettings.DnsServers = this.DnsSettingsDnsServer;
            }
            vNetworkInterfaceConfigurations.IpConfigurations = this.MyInvocation.BoundParameters.ContainsKey("IpConfiguration") ? this.IpConfiguration : null;
            this.VirtualMachineScaleSet.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations.Add(vNetworkInterfaceConfigurations);
            WriteObject(this.VirtualMachineScaleSet);
        }
Пример #4
0
        private void Run()
        {
            // VirtualMachineProfile
            if (this.VirtualMachineScaleSet.VirtualMachineProfile == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVMProfile();
            }

            // NetworkProfile
            if (this.VirtualMachineScaleSet.VirtualMachineProfile.NetworkProfile == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile.NetworkProfile = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetNetworkProfile();
            }

            // NetworkInterfaceConfigurations
            if (this.VirtualMachineScaleSet.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations = new List <Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetNetworkConfiguration>();
            }

            var vNetworkInterfaceConfigurations = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetNetworkConfiguration();

            vNetworkInterfaceConfigurations.Name    = this.Name;
            vNetworkInterfaceConfigurations.Primary = this.Primary;
            vNetworkInterfaceConfigurations.EnableAcceleratedNetworking = this.EnableAcceleratedNetworking.IsPresent;
            vNetworkInterfaceConfigurations.EnableIPForwarding          = this.EnableIPForwarding.IsPresent;
            vNetworkInterfaceConfigurations.Id = this.Id;
            if (this.NetworkSecurityGroupId != null)
            {
                // NetworkSecurityGroup
                vNetworkInterfaceConfigurations.NetworkSecurityGroup    = new Microsoft.Azure.Management.Compute.Models.SubResource();
                vNetworkInterfaceConfigurations.NetworkSecurityGroup.Id = this.NetworkSecurityGroupId;
            }
            if (this.DnsSettingsDnsServer != null)
            {
                // DnsSettings
                vNetworkInterfaceConfigurations.DnsSettings            = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetNetworkConfigurationDnsSettings();
                vNetworkInterfaceConfigurations.DnsSettings.DnsServers = this.DnsSettingsDnsServer;
            }
            vNetworkInterfaceConfigurations.IpConfigurations = this.IpConfiguration;
            this.VirtualMachineScaleSet.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations.Add(vNetworkInterfaceConfigurations);
            WriteObject(this.VirtualMachineScaleSet);
        }
        private void Run()
        {
            // VirtualMachineProfile
            if (this.VirtualMachineScaleSet.VirtualMachineProfile == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVMProfile();
            }

            // NetworkProfile
            if (this.VirtualMachineScaleSet.VirtualMachineProfile.NetworkProfile == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile.NetworkProfile = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetNetworkProfile();
            }

            // NetworkInterfaceConfigurations
            if (this.VirtualMachineScaleSet.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations = new List <Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetNetworkConfiguration>();
            }

            var vNetworkInterfaceConfigurations = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetNetworkConfiguration();

            vNetworkInterfaceConfigurations.Name    = this.MyInvocation.BoundParameters.ContainsKey("Name") ? this.Name : null;
            vNetworkInterfaceConfigurations.Primary = this.MyInvocation.BoundParameters.ContainsKey("Primary") ? this.Primary : (bool?)null;
            vNetworkInterfaceConfigurations.EnableAcceleratedNetworking = this.EnableAcceleratedNetworking.IsPresent;
            vNetworkInterfaceConfigurations.EnableIPForwarding          = this.EnableIPForwarding.IsPresent;
            vNetworkInterfaceConfigurations.Id = this.MyInvocation.BoundParameters.ContainsKey("Id") ? this.Id : null;
            if (this.MyInvocation.BoundParameters.ContainsKey("NetworkSecurityGroupId"))
            {
                // NetworkSecurityGroup
                vNetworkInterfaceConfigurations.NetworkSecurityGroup    = new Microsoft.Azure.Management.Compute.Models.SubResource();
                vNetworkInterfaceConfigurations.NetworkSecurityGroup.Id = this.NetworkSecurityGroupId;
            }
            if (this.MyInvocation.BoundParameters.ContainsKey("DnsSettingsDnsServer"))
            {
                // DnsSettings
                vNetworkInterfaceConfigurations.DnsSettings            = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetNetworkConfigurationDnsSettings();
                vNetworkInterfaceConfigurations.DnsSettings.DnsServers = this.DnsSettingsDnsServer;
            }
            vNetworkInterfaceConfigurations.IpConfigurations = this.MyInvocation.BoundParameters.ContainsKey("IpConfiguration") ? this.IpConfiguration : null;
            this.VirtualMachineScaleSet.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations.Add(vNetworkInterfaceConfigurations);
            WriteObject(this.VirtualMachineScaleSet);
        }