0

I keep getting this error when I use this cmdlet in my script block

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

Makes no sense to me. Everytime I search this error, it references Network related cmdlets.

$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    

    }
}

Some of the new configurations are added to my route table, but some error out with that error.. Hm..

New error -

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
meow tho
  • 37
  • 1
  • 1
  • 6
  • Provide your complete powershell command may be helpful. – Joy Wang Aug 09 '18 at 01:04
  • Updated! Sorry. – meow tho Aug 09 '18 at 01:49
  • I test your command, it works fine on my side. If I use a existed `addressPrefix`, I will get a bad request error. You could check it. – Joy Wang Aug 09 '18 at 02:44
  • Hmm, so I'm actually getting a long list of addresses (the azure govarizona and virgina) ones and s o m e of them work... I get like 5/20 to update.. so I'm not sure if it has to do with jobs..? overlapping?? – meow tho Aug 09 '18 at 02:50
  • Besides, `$udr` in your command means `route`, but `udr` is the shorthand of the azure route table, I recommend you to change it to avoid ambiguity. – Joy Wang Aug 09 '18 at 02:54

1 Answers1

0

I have reproduced your issue via an existing route name, before I run the command, I have a route called joyroute1 in the route table.

My test command:

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

Debug result:

enter image description here

So I think that your script uses conflict names of the routes, when it using some different names, it works, this explains why some of them work, you could check it.

Community
  • 1
  • 1
Joy Wang
  • 39,905
  • 3
  • 30
  • 54
  • Hmm, each name of my route it different, but how did you get this entire error message? – meow tho Aug 10 '18 at 03:51
  • @meowtho May be there is another reason can also cause this issue. I think you could try to use debug to see its error message. – Joy Wang Aug 10 '18 at 04:23
  • But how did you get the message to output the way that you did – meow tho Aug 10 '18 at 06:39
  • @meowtho You mean the debug error message? If so just use `-Debug` , and check the `HTTP RESPONSE`, I mentioned it in my test command, you could refer to it. – Joy Wang Aug 10 '18 at 06:41
  • Sorry, I noticed that. I realized it was the configs themselves still existing. Used a Get and deleted them before the Add – meow tho Aug 10 '18 at 07:16