2016-04-26 6 views
0

たとえば、「MyRouteTable」という名前のルートテーブルがあり、このルートテーブルに10のルートがあるとします。これらのルートのそれぞれに新しいNextHopAddressを割り当てたいと思います。PowerShellスクリプトを使用してAzureルートテーブルのルートにアクセスする方法はありますか?

PowerShellスクリプトを使用してこれらのルートをプログラムで取得して反復処理を行う方法はありますか?

答えて

2

あなたは次のようなコマンドを使用して、すべてのルート名を取得できます。

$table = Get-AzureRmRouteTable -ResourceGroupName "TestGP" -Name "routetable" 

# All the routes name will be stored in $routes 
$routes = @() 
foreach ($routeName in $table.Routes) 
{ 
    $routes += $i.Name 
} 

# Custom code here 

その後することができますループ路線名や更新のルートのように:

foreach ($routeName in $routes) 
{ 
    Set-AzureRmRouteConfig -Name $routeName -RouteTable $table -AddressPrefix <address prefix> -NextHopType <type> 
} 

# Sets the goal state for route table 
Set-AzureRmRouteTable -RouteTable $table 
+0

パーフェクト、私が探していただけのものを、ありがとう! –

関連する問題