我正在尝试使用PowerShell添加第二个子网。
我正在使用的代码是:
Add-AzureRmAccount
Select-AzureRmSubscription -SubscriptionId "XXXXXXXXXXXXXXXXXXXXXXXXXXX"
$vnetname = "confvnet"
$loc = "West Europe"
$backendSubnetName = "conf-jira-interlink"
$backendSubnetConfig = New-AzureRmVirtualNetworkSubnetConfig -Name $backendSubnetName -AddressPrefix "10.1.0.0/24"
echo "backendSubnetConfig: "$backendSubnetConfig
$vnet = Get-AzureRmVirtualNetwork -Name $vnetname -ResourceGroupName "resourcegroup-confluence-jira-datacenter"
echo "vnet: "$vnet
Add-AzureRmVirtualNetworkSubnetConfig -Name $backendSubnetName -VirtualNetwork $vnet -AddressPrefix "10.1.0.0/24"
$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" -VMScaleSetName "confcluster" -VirtualMachineScaleSet $vmss
但我收到错误消息
Update-AzureRmVmss : Cannot parse the request.
ErrorCode: InvalidRequestFormat
ErrorMessage: Cannot parse the request.
ErrorTarget:
StatusCode: 400
ReasonPhrase: Bad Request
OperationID : 94e52a04-67c4-4390-bbea-74849ccce4ac
In X:JIRA_Confluence_MigrationPowerShellnetwork-interfaces-azure-same-vnet.ps1:45 Zeichen:1
+ Update-AzureRmVmss -ResourceGroupName "resourcegroup-confluence-jira- ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Update-AzureRmVmss], ComputeCloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.Automation.UpdateAzureRmVmss
在命令Update-AzureRmVmss
。
谁能帮助我如何使用Update-AzureRmVmss
命令错误?
要将第二个子网添加到azure虚拟机刻度集中,您完成的大多数步骤都是正确的,并且您知道子网应该与已经在同一虚拟网络中。您可以像下面更改的参数。
Add-AzureRmVmssNetworkInterfaceConfiguration -Name a_string_name -Primary $false -IPConfiguration $ipCfg -VirtualMachineScaleSet $vmss
参数-Name
应该具有字符串值。看到它添加 - azurermvmssnetworkInterfaceConfiguration。
,您还需要做一个步骤。这是您需要对VMS进行处理,然后更新VMS。它不能支持在运行状态下更新VMS。