Azure portal を使用して Kerberos 認証の Bastion を構成する

この記事では、Kerberos 認証を使用するように Azure Bastion を構成する方法について説明します。 Kerberos 認証は、Basic および Standard Bastion SKU の両方で使用できます。 Kerberos 認証の詳細については、「Kerberos 認証の概要」を参照してください。 Azure Bastion の詳細については、「Azure Bastion とは」を参照してください。

考慮事項

  • Azure Bastion の Kerberos 設定は、Azure portal でのみ構成でき、ネイティブ クライアントでは構成できません。
  • オンプレミスから Azure に移行された VM は、現在 Kerberos ではサポートされていません。 
  • Kerberos では、領域間の認証は現在サポートされていません。
  • Doメイン コントローラーは、要塞がデプロイされているのと同じ VNET 内の Azure ホスト VM である必要があります。
  • Kerberos では、DNS サーバーへの変更は現在サポートされていません。 DNS サーバーに変更を加えたら、Bastion リソースを削除して再作成する必要があります。
  • 別の DC (ドメイン コントローラー) を追加した場合、Bastion は最初の DC のみを認識します。
  • 異なるドメイン用に別の DC を追加した場合、追加されたドメインは Kerberos で正常に認証できません。

前提条件

  • アクティブなサブスクリプションが含まれる Azure アカウント。 ない場合は、無料で作成してください。 Bastion を使用してブラウザーで VM に接続するためには、Azure portal にサインインできる必要があります。

  • Azure 仮想ネットワーク。 VNet を作成する手順については、クイック スタート: 仮想ネットワークの作成に関するページを参照してください。

VNet DNS サーバーを更新する

このセクションでは、次の手順を行うと、カスタム DNS 設定を指定するように仮想ネットワークを更新できます。

  1. Azure portal にサインインします。
  2. Bastion リソースをデプロイする仮想ネットワークに移動します。
  3. VNet の [DNS サーバー] ページに移動し、[カスタム] を選択します。 Azure でホストされているドメイン コントローラーの IP アドレスを追加し、[保存] を選択します。

Bastion をデプロイする

  1. チュートリアル: 手動構成設定を使用した Bastion のデプロイに関するページの手順を使用して、Bastion のデプロイの構成を開始します。 [基本] タブで設定を構成します。次に、ページ上部にある [詳細設定] をクリックして [詳細設定] タブに移動します。

  2. [詳細設定] タブで、[Kerberos] を選択します。

    Screenshot of select bastion features.

  3. ページ下部にある [確認と作成]、次に [作成] を選択して Bastion を仮想ネットワークにデプロイします。

  4. デプロイが完了したら、これを使用して、前の手順で指定した、カスタム DNS に参加している到達可能な任意の Windows VM にサインインできます。

既存の Bastion デプロイを変更するには

このセクションでは、次の手順を行うと、Kerberos 認証用の仮想ネットワークと既存の Bastion デプロイを容易に変更できます。

  1. 仮想ネットワークの DNS 設定を更新します
  2. Bastion デプロイのポータル ページに移動し、[構成] を選択します。
  3. [構成] ページで、[Kerberos 認証] を選択し、[適用] を選択します。
  4. Bastion は、新しい構成設定で更新されます。

Bastion で Kerberos が使用されていることを確認するには

注意

Kerberos を使用してサインインするには、ユーザー プリンシパル名 (UPN) を使用する必要があります。

ご利用の Bastion リソース上で Kerberos を有効にしたら、実際に Kerberos を使用してターゲット ドメインに参加している VM への認証を行っていることを確認できます。

  1. ターゲット VM にサインインします (Bastion 経由かそうでないかのどちらか)。 タスク バーから [グループ ポリシーの編集] を検索し、[ローカル グループ ポリシー エディター] を開きます。

  2. [コンピューターの構成]>[Windows の設定]>[セキュリティ設定]>[ローカル ポリシー]>[セキュリティ オプション]

  3. [ネットワーク セキュリティ: NTLM の制限: 着信 NTLM トラフィック] ポリシーを見つけて、それを [すべてのドメイン アカウントを拒否する] に設定します。 Bastion では Kerberos が無効である場合に認証に NTLM が使用されるため、この設定にすると、VM 上での今後のサインイン試行では NTLM ベースの認証は必ず失敗します。

  4. VM セッションを終了します。

  5. Bastion を使用してターゲット VM に再度接続します。 サインインは成功するはずです。これは、Bastion で認証に Kerberos (NTLM ではなく) が使用されたことを示します。

    Note

    NTLM へのフェールバックを防ぐために、前の手順に従ってください。 Kerberos を (手順に従わずに) 有効にしても、NTLM へのフェールバックは防止されません。

クイックスタート: Kerberos を使用した Bastion を設定する - Resource Manager テンプレート

テンプレートを確認する

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "location": {
      "defaultValue": "[resourceGroup().location]",
      "type": "string"
    },
    "defaultNsgName": {
      "type": "string",
      "defaultValue": "Default-nsg"
    },
    "VnetName": {
      "type": "string",
      "defaultValue": "myVnet"
    },
    "ClientVMName": {
      "defaultValue": "Client-vm",
      "type": "string"
    },
    "ServerVMName": {
      "defaultValue": "Server-vm",
      "type": "string"
    },
    "vmsize": {
      "defaultValue": "Standard_DS1_v2",
      "type": "string",
      "metadata": {
        "description": "VM SKU to deploy"
      }
    },
    "ServerVMUsername": {
      "type": "string",
      "defaultValue": "serveruser",
      "metadata": {
        "description": "Admin username on all VMs."
      }
    },
    "ServerVMPassword": {
      "type": "securestring",
      "metadata": {
        "description": "Admin password on all VMs."
      }
    },
    "SafeModeAdministratorPassword": {
      "type": "securestring",
      "metadata": {
        "description": "See https://learn.microsoft.com/en-us/powershell/module/addsdeployment/install-addsdomaincontroller?view=windowsserver2022-ps#-safemodeadministratorpassword"
      }
    },
    "ClientVMUsername": {
      "type": "string",
      "defaultValue": "clientuser",
      "metadata": {
        "description": "username on ClientVM."
      }
    },
    "ClientVMPassword": {
      "type": "securestring",
      "metadata": {
        "description": "password on ClientVM."
      }
    },
    "ServerVmImage": {
      "type": "object",
      "defaultValue": {
        "offer": "WindowsServer",
        "publisher": "MicrosoftWindowsServer",
        "sku": "2019-Datacenter",
        "version": "latest"
      }
    },
    "ClientVmImage": {
      "type": "object",
      "defaultValue": {
        "offer": "Windows",
        "publisher": "microsoftvisualstudio",
        "sku": "Windows-10-N-x64",
        "version": "latest"
      }
    },
    "publicIPAllocationMethod": {
      "type": "string",
      "defaultValue": "Static"
    },
    "BastionName": {
      "defaultValue": "Bastion",
      "type": "string"
    },
    "BastionPublicIPName": {
        "defaultValue": "Bastion-ip",
        "type": "string"
    }
  },
  "variables": {
    "DefaultSubnetId": "[concat(resourceId('Microsoft.Network/virtualNetworks', parameters('VnetName')), '/subnets/default')]",
    "ClientVMSubnetId": "[concat(resourceId('Microsoft.Network/virtualNetworks', parameters('VnetName')), '/subnets/clientvm-subnet')]",
    "DNSServerIpAddress": "10.16.0.4",
    "ClientVMPrivateIpAddress": "10.16.1.4"
  },
  "resources": [
    {
      "apiVersion": "2020-03-01",
      "name": "[parameters('VnetName')]",
      "type": "Microsoft.Network/virtualNetworks",
      "location": "[parameters('location')]",
      "properties": {
        "dhcpOptions": {
          "dnsServers": [ "[variables('DNSServerIpAddress')]" ]
        },
        "subnets": [
          {
            "name": "default",
            "properties": {
              "addressPrefix": "10.16.0.0/24"
            }
          },
          {
            "name": "clientvm-subnet",
            "properties": {
              "addressPrefix": "10.16.1.0/24"
            }
          },
          {
            "name": "AzureBastionSubnet",
            "properties": {
              "addressPrefix": "10.16.2.0/24"
            }
          }
        ],
        "addressSpace": {
          "addressPrefixes": [
            "10.16.0.0/16"
          ]
        }
      }
    },
    {
      "type": "Microsoft.Network/networkInterfaces",
      "apiVersion": "2018-10-01",
      "name": "[concat(parameters('ServerVMName'), 'Nic')]",
      "location": "[parameters('location')]",
      "dependsOn": [
        "[concat('Microsoft.Network/virtualNetworks/', parameters('VnetName'))]"
      ],
      "properties": {
        "ipConfigurations": [
          {
            "name": "[concat(parameters('ServerVMName'), 'NicIpConfig')]",
            "properties": {
              "privateIPAllocationMethod": "Static",
              "privateIPAddress": "[variables('DNSServerIpAddress')]",
              "subnet": {
                "id": "[variables('DefaultSubnetId')]"
              }
            }
          }
        ]
      }
    },
    {
      "type": "Microsoft.Compute/virtualMachines",
      "apiVersion": "2020-06-01",
      "name": "[parameters('ServerVMName')]",
      "location": "[parameters('location')]",
      "dependsOn": [
        "[concat('Microsoft.Network/networkInterfaces/', parameters('ServerVMName'), 'Nic')]"
      ],
      "properties": {
        "hardwareProfile": {
          "vmSize": "[parameters('vmSize')]"
        },
        "osProfile": {
          "AdminUsername": "[parameters('ServerVMUsername')]",
          "AdminPassword": "[parameters('ServerVMPassword')]",
          "computerName": "[parameters('ServerVMName')]"
        },
        "storageProfile": {
          "imageReference": "[parameters('ServerVmImage')]",
          "osDisk": {
            "createOption": "FromImage",
            "managedDisk": {
              "storageAccountType": "Standard_LRS"
            }
          }
        },
        "networkProfile": {
          "networkInterfaces": [
            {
              "id": "[ResourceId('Microsoft.Network/networkInterfaces/', concat(parameters('ServerVMName'), 'Nic'))]"
            }
          ]
        }
      }
    },
    {
      "type": "Microsoft.Compute/virtualMachines/extensions",
      "apiVersion": "2021-04-01",
      "name": "[concat(parameters('ServerVMName'),'/', 'PromoteToDomainController')]",
      "location": "[parameters('location')]",
      "dependsOn": [
        "[concat('Microsoft.Compute/virtualMachines/',parameters('ServerVMName'))]"
      ],
      "properties": {
        "publisher": "Microsoft.Compute",
        "type": "CustomScriptExtension",
        "typeHandlerVersion": "1.7",
        "autoUpgradeMinorVersion": true,
        "settings": {
          "commandToExecute": "[concat('powershell.exe -Command \"Install-windowsfeature AD-domain-services; Import-Module ADDSDeployment;$Secure_String_Pwd = ConvertTo-SecureString ',parameters('SafeModeAdministratorPassword'),' -AsPlainText -Force; Install-ADDSForest -DomainName \"bastionkrb.test\" -SafeModeAdministratorPassword $Secure_String_Pwd -Force:$true')]"
          }
      }
    },
    {
      "type": "Microsoft.Network/networkInterfaces",
      "apiVersion": "2018-10-01",
      "name": "[concat(parameters('ClientVMName'), 'Nic')]",
      "location": "[parameters('location')]",
      "dependsOn": [
        "[concat('Microsoft.Network/virtualNetworks/', parameters('VnetName'))]",
        "[concat('Microsoft.Compute/virtualMachines/', parameters('ServerVMName'))]"
      ],
      "properties": {
        "ipConfigurations": [
          {
            "name": "[concat(parameters('ClientVMName'), 'NicIpConfig')]",
            "properties": {
              "privateIPAllocationMethod": "Static",
              "privateIPAddress": "[variables('ClientVMPrivateIpAddress')]",
              "subnet": {
                "id": "[variables('ClientVMSubnetId')]"
              }
            }
          }
        ]
      }
    },
    {
      "type": "Microsoft.Compute/virtualMachines",
      "apiVersion": "2020-06-01",
      "name": "[parameters('ClientVMName')]",
      "location": "[parameters('location')]",
      "dependsOn": [
        "[concat('Microsoft.Network/networkInterfaces/', parameters('ClientVMName'), 'Nic')]"
      ],
      "properties": {
        "hardwareProfile": {
          "vmSize": "[parameters('vmSize')]"
        },
        "osProfile": {
          "AdminUsername": "[parameters('ClientVMUsername')]",
          "AdminPassword": "[parameters('ClientVMPassword')]",
          "computerName": "[parameters('ClientVMName')]"
        },
        "storageProfile": {
          "imageReference": "[parameters('ClientVmImage')]",
          "osDisk": {
            "createOption": "FromImage",
            "managedDisk": {
              "storageAccountType": "Standard_LRS"
            }
          }
        },
        "networkProfile": {
          "networkInterfaces": [
            {
              "id": "[ResourceId('Microsoft.Network/networkInterfaces/', concat(parameters('ClientVMName'), 'Nic'))]"
            }
          ]
        }
      }
    },
    {
      "type": "Microsoft.Compute/virtualMachines/extensions",
      "apiVersion": "2021-04-01",
      "name": "[concat(parameters('ClientVMName'),'/', 'DomainJoin')]",
      "location": "[parameters('location')]",
      "dependsOn": [
        "[concat('Microsoft.Compute/virtualMachines/',parameters('ClientVMName'))]",
        "[concat('Microsoft.Compute/virtualMachines/', parameters('ServerVMName'),'/extensions/', 'PromoteToDomainController')]",
        "[concat('Microsoft.Network/bastionHosts/', parameters('BastionName'))]"
      ],
      "properties": {
        "publisher": "Microsoft.Compute",
        "type": "CustomScriptExtension",
        "typeHandlerVersion": "1.7",
        "autoUpgradeMinorVersion": true,
        "settings": {
          "commandToExecute": "[concat('powershell.exe -Command Set-ItemProperty -Path HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Lsa\\MSV1_0\\ -Name RestrictReceivingNTLMTraffic -Value 1; $Pass= ConvertTo-SecureString -String ',parameters('ServerVMPassword'),' -AsPlainText -Force; $Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList \"AD\\serveruser\", $Pass; do { try { $joined = add-computer -computername Client-vm -domainname bastionkrb.test –credential $Credential -passthru -restart –force; } catch {}} while ($joined.HasSucceeded -ne $true)')]"
          }
      }
    },
    {
      "apiVersion": "2020-11-01",
      "type": "Microsoft.Network/publicIPAddresses",
      "name": "[parameters('BastionPublicIPName')]",
      "location": "[resourceGroup().location]",
      "sku": {
        "name": "Standard"
      },
      "properties": {
        "publicIPAllocationMethod": "Static"
      },
      "tags": {}
    },
    {
        "type": "Microsoft.Network/bastionHosts",
        "apiVersion": "2020-11-01",
        "name": "[parameters('BastionName')]",
        "location": "[resourceGroup().location]",
        "dependsOn": [
            "[concat('Microsoft.Network/virtualNetworks/', parameters('VnetName'))]",
            "[concat('Microsoft.Network/publicIpAddresses/', parameters('BastionPublicIPName'))]"
        ],
        "sku": {
            "name": "Standard"
        },
        "properties": {
            "enableKerberos": "true",
            "ipConfigurations": [
                {
                    "name": "IpConf",
                    "properties": {
                        "privateIPAllocationMethod": "Dynamic",
                        "publicIPAddress": {
                            "id": "[resourceId('Microsoft.Network/publicIpAddresses', parameters('BastionPublicIPName'))]"
                        },
                        "subnet": {
                            "id": "[concat(resourceId('Microsoft.Network/virtualNetworks', parameters('VnetName')), '/subnets/AzureBastionSubnet')]"
                        }
                    }
                }
            ]
        }
    }
  ]
}

このテンプレートには、次のリソースが定義されています。

  • 次の Azure リソースをデプロイします。
  • VNet の DNS サーバーが ServerVM (ドメイン コントローラー) のプライベート IP アドレスをポイントするようにします。
  • ServerVM でカスタム スクリプト拡張機能を実行して、ドメイン名 bastionkrb.test を持つドメイン コントローラーに昇格させます。
  • ClientVM でカスタム スクリプト拡張機能を実行して、それを使用します。
    • NTLM を制限する: 受信 NTLM トラフィック = すべてのドメイン アカウントを拒否する (これは、Kerberos が認証に使用されるようにするためです)。
    • bastionkrb.test ドメインにドメイン参加します。

テンプレートのデプロイ

Kerberos を設定するには、次の PowerShell コマンドを実行して、前の ARM テンプレートをデプロイします。

New-AzResourceGroupDeployment -ResourceGroupName <your-rg-name> -TemplateFile "<path-to-template>\KerberosDeployment.json"`

デプロイされているリソースを確認する

次に、Kerberos 認証で Bastion を使用して ClientVM にサインインします。

  • 資格情報: username = serveruser@bastionkrb.test、password = <password-entered-during-deployment>

次の手順

Azure Bastion の詳細については、「Azure Bastion とは」を参照してください。