正在获取无法解析请求。在PowerShell上的Module Update-AzureRmVmss(错误代码:InvalidRequestFormat)

时间:2019-06-23 14:34:33

标签: azure powershell subnet nic

我正在尝试使用PowerShell将第二个子网添加到Azure虚拟机规模集。

我正在使用的代码是:

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_Migration\PowerShell\network-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命令吗?

1 个答案:

答案 0 :(得分:0)

要将第二个子网添加到Azure虚拟机规模集,您已完成的大多数步骤都是正确的,并且您知道该子网应该与已经存在的VMSS位于同一虚拟网络中。只需更改一些参数即可,如下所示。< / p>

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

参数-Name应该具有字符串值。见Add-AzureRmVmssNetworkInterfaceConfiguration

您还需要执行一个步骤。您需要取消分配VMSS,然后更新VMSS。它不支持在运行状态下更新VMSS。