在 UpdateAzureRm-Vmss 上获取 Powershell 错误 cannot reference subnets from different virtual networks
Getting the Powershell error cannot reference subnets from different virtual networks on UpdateAzureRm-Vmss
我正在尝试向 Azure 虚拟机规模集添加第二个网络适配器。
这是我使用的代码:
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
Update-AzureRmVmss -ResourceGroupName "resourcegroup-confluence-jira-datacenter" -Name "confcluster" -VirtualMachineScaleSet $vmss
但我收到错误消息:
Update-AzureRmVmss : VM scale set
/subscriptions/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/resourceGroups/RESOURCEGROUP-CONF
LUENCE-JIRA-DATACENTER/providers/Microsoft.Compute/virtualMachineScaleSets/confcluster
cannot reference subnets /subscr
iptions/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/resourceGroups/resourcegroup-confluence-jira-datacenter/providers/Microsof
t.Network/virtualNetworks/confvnet/subnets/confclustersubnet,/subscriptions/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/resour
ceGroups/resourcegroup-confluence-jira-datacenter/providers/Microsoft.Network/virtualNetworks/conf-virtual-network-inte
rlink/subnets/default from different virtual networks. ErrorCode:
VMScaleSetCannotReferenceSubnetsFromDifferentVirtualNetworks
ErrorMessage: VM scale set
/subscriptions/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/resourceGroups/RESOURCEGROUP-CONFLUENCE-
JIRA-DATACENTER/providers/Microsoft.Compute/virtualMachineScaleSets/confcluster
cannot reference subnets /subscriptions
/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/resourceGroups/resourcegroup-confluence-jira-datacenter/providers/Microsoft.Netwo
rk/virtualNetworks/confvnet/subnets/confclustersubnet,/subscriptions/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/resourceGroup
s/resourcegroup-confluence-jira-datacenter/providers/Microsoft.Network/virtualNetworks/conf-virtual-network-interlink/s
ubnets/default from different virtual networks. ErrorTarget:
StatusCode: 400 ReasonPhrase: Bad Request OperationID :
ebdcd379-2dba-4a2d-97a8-52c7870a8755 In
X:\JIRA_Confluence_Migration\PowerShell\network-interfaces-azure.ps1:49
Zeichen:1
+ Update-AzureRmVmss -ResourceGroupName "resourcegroup-confluence-jira- ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Update-AzureRmVmss], ComputeCloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.Automation.UpdateAzureRmVmss
但我的意图实际上是从不同的虚拟网络添加两个不同的网络适配器。
据我所知,不同的虚拟网络中不能有不同的网络适配器。它们必须在同一个虚拟网络上,它们可以在同一个虚拟网络中的不同子网上
我正在尝试向 Azure 虚拟机规模集添加第二个网络适配器。
这是我使用的代码:
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
Update-AzureRmVmss -ResourceGroupName "resourcegroup-confluence-jira-datacenter" -Name "confcluster" -VirtualMachineScaleSet $vmss
但我收到错误消息:
Update-AzureRmVmss : VM scale set /subscriptions/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/resourceGroups/RESOURCEGROUP-CONF LUENCE-JIRA-DATACENTER/providers/Microsoft.Compute/virtualMachineScaleSets/confcluster cannot reference subnets /subscr iptions/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/resourceGroups/resourcegroup-confluence-jira-datacenter/providers/Microsof t.Network/virtualNetworks/confvnet/subnets/confclustersubnet,/subscriptions/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/resour ceGroups/resourcegroup-confluence-jira-datacenter/providers/Microsoft.Network/virtualNetworks/conf-virtual-network-inte rlink/subnets/default from different virtual networks. ErrorCode: VMScaleSetCannotReferenceSubnetsFromDifferentVirtualNetworks ErrorMessage: VM scale set /subscriptions/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/resourceGroups/RESOURCEGROUP-CONFLUENCE- JIRA-DATACENTER/providers/Microsoft.Compute/virtualMachineScaleSets/confcluster cannot reference subnets /subscriptions /XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/resourceGroups/resourcegroup-confluence-jira-datacenter/providers/Microsoft.Netwo rk/virtualNetworks/confvnet/subnets/confclustersubnet,/subscriptions/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/resourceGroup s/resourcegroup-confluence-jira-datacenter/providers/Microsoft.Network/virtualNetworks/conf-virtual-network-interlink/s ubnets/default from different virtual networks. ErrorTarget: StatusCode: 400 ReasonPhrase: Bad Request OperationID : ebdcd379-2dba-4a2d-97a8-52c7870a8755 In X:\JIRA_Confluence_Migration\PowerShell\network-interfaces-azure.ps1:49 Zeichen:1 + Update-AzureRmVmss -ResourceGroupName "resourcegroup-confluence-jira- ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [Update-AzureRmVmss], ComputeCloudException + FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.Automation.UpdateAzureRmVmss
但我的意图实际上是从不同的虚拟网络添加两个不同的网络适配器。
据我所知,不同的虚拟网络中不能有不同的网络适配器。它们必须在同一个虚拟网络上,它们可以在同一个虚拟网络中的不同子网上