1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Azure】ルートテーブルのルールタイプを検証(Bicep構成付き)

Posted at

1. はじめに

1-1 ご挨拶

初めまして、井村と申します。

Azureのルートテーブルに設定できるルールの種類を確認したく、備忘録として記録します。

2. 構築

2-1 テンプレート

今回はBicepテンプレートを用いて構築します。
ルールの組み合わせに特別な意図はありません。

main.bicep
main.bicep
resource rt1 'Microsoft.Network/routeTables@2023-09-01' = {
  name: 'rt-1'
  location: 'japaneast'
  properties: {
    disableBgpRoutePropagation: false
    routes: [
      {
        name: 'Allow_Internet_rt'
        properties: {
          addressPrefix: '0.0.0.0/0'
          nextHopType: 'VirtualAppliance'
          nextHopIpAddress: '10.0.10.4'
        }
      }
      {
        name: 'Allow_KMS_20.118.99.224_rt'
        properties: {
          addressPrefix: '20.118.99.224/32'
          nextHopType: 'Internet'
        }
      }
      {
        name: 'Allow_KMS_40.83.235.53_rt'
        properties: {
          addressPrefix: '40.83.235.53/32'
          nextHopType: 'Internet'
        }
      }
      {
        name: 'Allow_KMS_23.102.135.246_rt'
        properties: {
          addressPrefix: '23.102.135.246/32'
          nextHopType: 'Internet'
        }
      }
    ]
  }
}

resource rt2 'Microsoft.Network/routeTables@2023-09-01' = {
  name: 'rt-2'
  location: 'japaneast'
  properties: {
    disableBgpRoutePropagation: true
    routes: [
      {
        name: 'Allow_Internet_rt'
        properties: {
          addressPrefix: '0.0.0.0/0'
          nextHopType: 'Internet'
        }
      }
      {
        name: 'Allow_Storage_rt'
        properties: {
          addressPrefix: 'Storage'
          nextHopType: 'Internet'
        }
      }
      {
        name: 'Allow_StorageJapanEast_rt'
        properties: {
          addressPrefix: 'Storage.JapanEast'
          nextHopType: 'Internet'
        }
      }
      {
        name: 'Allow_StorageJapanWest_rt'
        properties: {
          addressPrefix: 'Storage.JapanWest'
          nextHopType: 'Internet'
        }
      }
      {
        name: 'Allow_GuestAndHybridManagement_rt'
        properties: {
          addressPrefix: 'GuestAndHybridManagement'
          nextHopType: 'Internet'
        }
      }
      {
        name: 'Allow_AzureMonitor_rt'
        properties: {
          addressPrefix: 'AzureMonitor'
          nextHopType: 'Internet'
        }
      }
      {
        name: 'Allow_AzureResourceManager_rt'
        properties: {
          addressPrefix: 'AzureResourceManager'
          nextHopType: 'Internet'
        }
      }
      {
        name: 'Allow_AzureBackup_rt'
        properties: {
          addressPrefix: 'AzureBackup'
          nextHopType: 'Internet'
        }
      }
      {
        name: 'Allow_AzureUpdateDelivery_rt'
        properties: {
          addressPrefix: 'AzureUpdateDelivery'
          nextHopType: 'Internet'
        }
      }
      {
        name: 'Allow_AzureFrontDoor.FirstParty_rt'
        properties: {
          addressPrefix: 'AzureFrontDoor.FirstParty'
          nextHopType: 'Internet'
        }
      }
      {
        name: 'Allow_AzureActiveDirectory_rt'
        properties: {
          addressPrefix: 'AzureActiveDirectory'
          nextHopType: 'Internet'
        }
      }
    ]
  }
}

resource rt3 'Microsoft.Network/routeTables@2023-09-01' = {
  name: 'rt-3'
  location: 'japaneast'
  properties: {
    disableBgpRoutePropagation: true
    routes: [
      {
        name: 'Allow_Internet_rt'
        properties: {
          addressPrefix: '0.0.0.0/0'
          nextHopType: 'VirtualNetworkGateway'
        }
      }
      {
        name: 'Allow_AzureCloud.japaneast_rt'
        properties: {
          addressPrefix: 'AzureCloud.japaneast'
          nextHopType: 'Internet'
        }
      }
      {
        name: 'Allow_AzureCloud.japawest_rt'
        properties: {
          addressPrefix: 'AzureCloud.japanwest'
          nextHopType: 'Internet'
        }
      }
      {
        name: 'Allow_AzureCloud.southeastasia_rt'
        properties: {
          addressPrefix: 'AzureCloud.southeastasia'
          nextHopType: 'Internet'
        }
      }
    ]
  }
}


以下コマンドでルートテーブルを構築します。

azure cli
# Azureへログイン
az login

# 既存リソースグループへルートテーブルをデプロイ
az deployment group create --template-file main.bicep --resource-group <resource group name>

3. 確認

3-1 全体

3つのルートテーブルがデプロイされます。

001.png

3-2 個別

010.png

  • disableBgpRoutePropagation が false のため、BGPルート伝播は有効(Yes)です。
disableBgpRoutePropagation: false

003.png

  • 0.0.0.0/0はインターネット直接なのでAzure Firewall に適用するルートテーブルの典型的な構成です。
  • 他はサービスタグになります。

011.png

012.png

  • disableBgpRoutePropagation が true のため、BGPルート伝播は無効(No)です。
disableBgpRoutePropagation: true

005.png

  • 0.0.0.0/0は仮想ネットワークゲートウェイなので仮想ネットワークゲートウェイ(VPN等)行きのイメージになります。

013.png

以上になります。

4. 終わりに

本記事を最後まで読んで頂きましてありがとうございます。
最近、最初はポータルで検証し備忘録としてIaC化することが通例となっています。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?