0

当我在脚本块中使用此 cmdlet 时,我不断收到此错误

Cannot parse the request.
StatusCode: 400
ReasonPhrase: Bad Request
OperationID : '2410b534-3ab9-4c82-b0fa-233e5a36e795'
    + CategoryInfo          : CloseError: (:) [Set-AzureRmRouteTable], NetworkCloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Network.SetAzureRouteTableCommand
    + PSComputerName        : localhost

对我来说毫无意义。每次我搜索此错误时,它都会引用与网络相关的 cmdlet。

$addConfigBlock = {
    Param(
        $udr,
        $routeTableName,
        $routeTableRG
    )
    $routeTable = Get-AzureRmRouteTable -ResourceGroupName $routeTableRG -Name $routeTableName
    try{
        Add-AzureRmRouteConfig -RouteTable $routeTable `
                                -Name $udr.Name `
                                -AddressPrefix $udr.properties.addressPrefix `
                                -NextHopType $udr.properties.nextHopType |  `
        Set-AzureRmRouteTable | Out-Null
    }
    catch {            
        $ErrorMessage = $_.Exception.Message
            Write-Output "$ErrorMessage"
    }   
}


foreach( $routeTable in $routeTablesToUpdate){
    Write-Output "Updating routes in route table : $($routeTable.Name) ..."
    ForEach($udr in $udrGov){
        Start-Job -ScriptBlock $addConfigBlock -ArgumentList $udr, $routeTable.Name, $routeTable.ResourceGroupName    

    }
}

一些新配置已添加到我的路由表中,但该错误出现了一些错误..嗯..

新错误 -

A retryable error occurred.
StatusCode: 429
ReasonPhrase:
OperationID : '927995e6-da07-4f99-bbf3-6dd59e7c3183'
    + CategoryInfo          : CloseError: (:) [Set-AzureRmRouteTable], NetworkCloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Network.SetAzureRouteTableCommand
    + PSComputerName        : localhost
4

1 回答 1

0

我已经通过现有的路由名称重现了您的问题,在我运行命令之前,我joyroute1在路由表中调用了一个路由。

我的测试命令:

$routeTable = Get-AzureRmRouteTable -ResourceGroupName joywebapp -Name joyudr
        Add-AzureRmRouteConfig -RouteTable $routeTable `
                                -Name joyroute1 `
                                -AddressPrefix 10.1.0.0/18 `
                                -NextHopType VirtualNetworkGateway |  `
        Set-AzureRmRouteTable -Debug

调试结果:

在此处输入图像描述

所以我认为你的脚本使用了路径的冲突名称,当它使用一些不同的名称时,它可以工作,这解释了为什么其中一些工作,你可以检查一下。

于 2018-08-09T03:09:08.967 回答