azure - 如何将第二个网络接口(interface)添加到 Azure 虚拟机规模集?

标签 azure powershell nic

我正在尝试使用 Windows PowerShell 将第二个网络接口(interface)添加到 Microsoft Azure 虚拟机规模集 (VMSS)。 VMSS 已存在。

我正在使用 Powershell,因为 az cli 尚不支持添加网络接口(interface)。

但是我的代码似乎不起作用,因为虚拟机中没有出现网络接口(interface)。

我引用了 http://thebluenode.com/azure-virtual-machine-scale-set-instances-upgrade-with-zero-downtime-rolling-update 中的代码.

请查看我的 Powershell 代码我做错了什么。我想我必须添加一些私有(private)IP配置,但我不知道在哪里。

您能帮助我如何向我的 VMSS 添加第二个网络接口(interface)吗?

提前致谢。

最诚挚的问候,

罗尼·福伯格

尝试了提供的 Powershell 代码。

Add-AzureRmAccount

Select-AzureRmSubscription -SubscriptionId "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"


$vnetname = "conf-virtual-network-interlink"

$loc = "West Europe"

$backendSubnetName = "default"

$backendSubnetConfig = New-AzureRmVirtualNetworkSubnetConfig -Name $backendSubnetName -AddressPrefix "10.1.0.0/24"

echo "backendSubnetConfig: "$backendSubnetConfig

$vnet = New-AzureRmVirtualNetwork -ResourceName $vnetname -Location $loc -ResourceGroupName "resourcegroup-confluence-jira-datacenter" -Subnet $backendSubnetConfig -AddressPrefix "10.1.0.0/24"

echo "vnet: "$vnet

$subnetId = (Get-AzureRmVirtualNetworkSubnetConfig -Name $backendSubnetName -VirtualNetwork $vnet).Id

echo "subnetId: "$subnetId

$ipCfg = New-AzureRmVmssIPConfig -Name 'eth1' -SubnetId $subnetId 

echo "ipCfg: "$ipCfg

$backendSubnet = Get-AzureRmVirtualNetworkSubnetConfig -Name $backendSubnetName -VirtualNetwork $vnet

echo "backendSubnet: "$backendSubnet

$vmss = Get-AzureRmVmss -ResourceGroupName resourcegroup-confluence-jira-datacenter -VMScaleSetName confcluster

echo "vmss: "$vmss

Add-AzureRmVmssNetworkInterfaceConfiguration -Name $backendSubnet -Primary $false -IPConfiguration $ipCfg -VirtualMachineScaleSet $vmss

预期结果是 VMSS 的 VM 中的网络适配器启动(最好具有配置的专用 IP)。

最佳答案

不同的虚拟网络中不可能有不同的网络适配器。它们必须位于同一虚拟网络上,也可以位于同一虚拟网络中的不同子网上

关于azure - 如何将第二个网络接口(interface)添加到 Azure 虚拟机规模集?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56700254/

相关文章:

linux - 如何在使用同一网关运行的同一子网上路由具有 2 个公共(public) IP 的 2 个网卡

powershell - 缺少 Microsoft Graph ServicePrincipal

Azure 数据工厂事件副本从 foreach 事件获取多个表名称

c# - .Net/C# 中远程启动和关闭 Azure 服务器

powershell - 如何在 Windows 10 上使用 Powershell 将 Google Colab 与本地 TensorFlow Jupyter 服务器结合使用?

c - 环回接口(interface)是否在网卡/硬件上产生中断

azure 媒体服务-请求正文太大并超出最大允许限制

azure - 使用 AZ 副本将文件从 Azure VM 传输到 Blob 容器

powershell - 使用PoSH取值,奇怪的结果

Python,如何使用多个 NIC 获取所有外部 ip 地址