【发布时间】:2021-04-12 08:39:28
【问题描述】:
删除 vmss 网络接口配置时出错。代码如下:
$myVmss = Get-AzVmss -ResourceGroupName 'MyApp-test-rg' -VMScaleSetName 'Myapp-vmss'
Remove-AzVmssNetworkInterfaceConfiguration -VirtualMachineScaleSet $myVmss -Name $myVmss.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations.IPConfigurations.Name
得到错误-
Remove-AzVmssNetworkInterfaceConfiguration: Sequence contains no matching element
有人可以推荐一下吗。
已编辑:
我要做的就是将基本 LB 的后端池配置应用于新的标准 LB。在遵循 Joy 的建议后,删除命令有效,但现在在 update-azvmss 命令上遇到问题。
$myVmss = Get-AzVmss -ResourceGroupName $rgName -VMScaleSetName $vmssName
$newlb = (Get-AzLoadBalancer -ResourceGroupName $rgName -Name $newLbName)
$mySubnetId = $myVmss.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations.IpConfigurations[0].Subnet.Id
$backendPoolId = $newlb.BackendAddressPools.Id
$ipConfig = New-AzVmssIpConfig -Name MyNewConfig -SubnetId $mySubnetId -LoadBalancerBackendAddressPoolsId $backendPoolId
Remove-AzVmssNetworkInterfaceConfiguration -VirtualMachineScaleSet $myVmss -Name $myVmss.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations.Name[1]
Add-AzVmssNetworkInterfaceConfiguration -Name MyNewConfig -Primary $true -VirtualMachineScaleSet $myVmss -IpConfiguration $ipConfig
$myVmss | Update-AzVmss
这是错误-
Update-AzVmss: Primary network interface configuration of VM scale set /subscriptions/xxxxxxxxxxxx/resourceGroups/xxxxxx-RG/providers/Microsoft.Compute/virtualMachineScaleSets/xxxxxxx cannot be changed. Original Primary network interface configuration: xxxxxx-vnet-v2-nic01, Requested: MyNewConfig.
【问题讨论】:
标签: azure powershell azure-virtual-machine azure-powershell azure-load-balancer