Azure Stack HCI で Arc 仮想マシンのネットワーク インターフェイスを作成する

適用対象: Azure Stack HCI バージョン 23H2

この記事では、Azure Stack HCI クラスター上の Arc VM に関連付けることができるネットワーク インターフェイスを作成する方法について説明します。 ネットワーク インターフェイスは、Azure portal または Azure CLI を使用して作成できます。

ネットワーク インターフェイスについて

ネットワーク インターフェイスは Azure リソースであり、クラスターに仮想マシンをデプロイするために使用できます。 論理ネットワークが作成されたら、ネットワーク インターフェイスを作成し、作成する仮想マシンに関連付けることができます。

ネットワーク インターフェイスは、Azure portal または Azure CLI を使用して作成できます。 Azure portal を使用する場合、ネットワーク インターフェイスの作成は VM 作成プロセスの一部です。 Azure CLI を使用する場合は、最初にネットワーク インターフェイスを作成してから、それを使用して VM を作成できます。

前提条件

ネットワーク インターフェイスを作成する前に、次の前提条件が満たされていることを確認します。

ネットワーク インターフェイスを作成する

VM を作成するには、まず論理ネットワーク上にネットワーク インターフェイスを作成する必要があります。 論理ネットワークが静的であるか DHCP であるかによって、手順が異なる場合があります。

サインインしてサブスクリプションを設定する

  1. Azure Stack HCI システム上 サーバーに接続します。

  2. サインインする。 型:

    az login --use-device-code
    
  3. サブスクリプションを設定します。

    az account set --subscription <Subscription ID>
    

静的 IP を使用した仮想ネットワーク インターフェイス

静的論理ネットワーク上にネットワーク インターフェイスを作成するには、次の手順に従います。 < >のパラメーターを適切な値に置き換えます。

  1. 必要なパラメーターを設定します。 出力例を次に示します。

    $lnetName = "myhci-lnet-static"
    $gateway ="100.68.180.1" 
    $ipAddress ="100.68.180.6" 
    $nicName ="myhci-nic-static"
    $subscription =  "<Subscription ID>"
    $resource_group = "myhci-rg"
    $customLocationName = "myhci-cl" 
    $customLocationID ="/subscriptions/$subscription/resourceGroups/$resource_group/providers/Microsoft.ExtendedLocation/customLocations/$customLocationName"
    $location = "eastus"
    

    パラメーターの説明を次に示します。

    パラメーター 内容
    name Azure Stack HCI クラスターにデプロイされた論理ネットワークに作成するネットワーク インターフェイスの名前。 Azure resources.Rules に続く名前を指定してくださいネットワーク インターフェイスの作成後に名前を変更することはできません。
    resource-group Azure Stack HCI がデプロイされているリソース グループの名前。 これは、別の事前に作成されたリソース グループである場合もあります。
    subscription Azure Stack HCI がデプロイされているサブスクリプションの名前または ID。 これは、Azure Stack HCI クラスター上の論理ネットワークに使用する別のサブスクリプションである可能性があります。
    custom-location Azure Stack HCI クラスター上の論理ネットワークに使用するカスタムの場所の名前または ID。
    location az locationsで指定されている Azure リージョン。 たとえば、westeuropeeastusできます。
    subnet-id 論理ネットワークの名前。 (例: test-lnet-dynamic)。
    ip-allocation-method IP アドレスの割り当て方法。ネットワーク インターフェイスの dynamic または static できます。 このパラメーターが指定されていない場合、既定では、ネットワーク インターフェイスは動的構成で作成されます。
    ip-address 作成するネットワーク インターフェイスに割り当てる IPv4 アドレス。 例: "192.168.0.10"。
  2. 静的 IP アドレスを持つネットワーク インターフェイスを作成するには、次のコマンドを実行します。

    az stack-hci-vm network nic create --subscription $subscription --resource-group $resource_group --custom-location $customLocationID --location $location --name $nicName --subnet-id $lnetName --ip-address $ipAddress
    

    出力例を次に示します。

    {
      "extendedLocation": {
        "name": "/subscriptions/<subscription ID>/resourceGroups/myhci-rg/providers/Microsoft.ExtendedLocation/customLocations/myhci-cl",
        "type": "CustomLocation"
      },
      "id": "/subscriptions/<subscription ID>/resourceGroups/myhci-rg/providers/Microsoft.AzureStackHCI/networkinterfaces/myhci-nic-static",
      "location": "eastus",
      "name": "myhci-nic-static",
      "properties": {
        "dnsSettings": {
          "dnsServers": null
        },
        "ipConfigurations": [
          {
            "name": null,
            "properties": {
              "gateway": "192.168.200.1",
              "prefixLength": "24",
              "privateIpAddress": "192.168.201.3",
              "privateIpAllocationMethod": null,
              "subnet": {
                "id": "/subscriptions/<subscription ID>/resourceGroups/myhci-rg/providers/Microsoft.AzureStackHCI/logicalnetworks/myhci-lnet-static",
                "resourceGroup": "myhci-rg"
              }
            }
          }
        ],
        "macAddress": null,
        "provisioningState": "Succeeded",
        "resourceName": null,
        "status": {}
      },
      "resourceGroup": "myhci-rg",
      "systemData": {
        "createdAt": "2023-11-02T23:00:47.714910+00:00",
        "createdBy": "guspinto@contoso.com",
        "createdByType": "User",
        "lastModifiedAt": "2023-11-02T23:02:08.720545+00:00",
        "lastModifiedBy": "<ID>",
        "lastModifiedByType": "Application"
      },
      "tags": null,
      "type": "microsoft.azurestackhci/networkinterfaces"
    } 
    

DHCP を使用した仮想ネットワーク インターフェイス

DHCP 論理ネットワークにネットワーク インターフェイスを作成するには、次の手順に従います。 < >のパラメーターを適切な値に置き換えます。

  1. 必要なパラメーターを設定します。 出力例を次に示します。

    $nicName = "myhci-nic-dhcp"
    $lnetName = "myhci-lnet-dhcp"   
    $subscription =  "<subscription ID>" 
    $resource_group = "myhci-rg"
    $customLocationName = "myhci-cl" 
    $customLocationID ="/subscriptions/$subscription/resourceGroups/$resource_group/providers/Microsoft.ExtendedLocation/customLocations/$customLocationName"
    $location = "eastus"
    

    パラメーターの説明を次に示します。

    パラメーター 内容
    name Azure Stack HCI クラスターにデプロイされた論理ネットワークに作成するネットワーク インターフェイスの名前。 Azure resources.Rules に続く名前を指定してくださいネットワーク インターフェイスの作成後に名前を変更することはできません。
    resource-group Azure Stack HCI がデプロイされているリソース グループの名前。 これは、別の事前に作成されたリソース グループである場合もあります。
    subscription Azure Stack HCI がデプロイされているサブスクリプションの名前または ID。 これは、Azure Stack HCI クラスター上の論理ネットワークに使用する別のサブスクリプションである可能性があります。
    custom-location Azure Stack HCI クラスター上の論理ネットワークに使用するカスタムの場所の名前または ID。
    location az locationsで指定されている Azure リージョン。 たとえば、eastus になります。
    subnet-id 論理ネットワークの名前。 (例: test-lnet-dynamic)。
  2. ネットワーク インターフェイスを作成するには、次のコマンドを実行します。

    az stack-hci-vm network nic create --subscription $subscription --resource-group $resource_group --custom-location $customLocationID --location $location --name $nicName --subnet-id $lnetName
    

    出力例を次に示します。

    {
      "extendedLocation": {
        "name": "/subscriptions/<subscription ID>/resourceGroups/myhci-rg/providers/Microsoft.ExtendedLocation/customLocations/myhci-cl",
        "type": "CustomLocation"
      },
      "id": "/subscriptions/<subscription ID>/resourceGroups/myhci-rg/providers/Microsoft.AzureStackHCI/networkinterfaces/myhci-vnic",
      "location": "eastus",
      "name": "myhci-nic-dhcp",
      "properties": {
        "ipConfigurations": [
          {
            "name": null,
            "properties": {
              "gateway": null,
              "prefixLength": null,
              "privateIpAddress": null,
              "privateIpAllocationMethod": null,
              "subnet": {
                "id": "myhci-lnet-dhcp"
              }
            }
          }
        ],
        "macAddress": null,
        "provisioningState": "Succeeded",
        "resourceName": "myhci-nic-dhcp",
        "status": {}
      },
      "resourceGroup": "myhci-rg",
      "systemData": {
        "createdAt": "2023-02-08T23:25:10.984508+00:00",
        "createdBy": "guspinto@contoso.com",
        "createdByType": "User",
        "lastModifiedAt": "2023-02-08T23:26:03.262252+00:00",
        "lastModifiedBy": "<ID>",
        "lastModifiedByType": "Application"
      },
      "tags": null,
      "type": "microsoft.azurestackhci/networkinterfaces"
    }
    PS C:\windows\system32> 
    

このネットワーク インターフェイスを使用して VM を作成できます。 詳細については、「VM の作成」を参照してください。

次のステップ