빠른 시작: ARM 템플릿(Azure Resource Manager 템플릿)을 사용하여 Azure Operator Nexus 가상 머신 만들기

  • Azure Resource Manager 템플릿을 사용하여 Azure Nexus 가상 머신을 배포합니다.

이 빠른 시작 가이드는 Nexus 가상 머신을 사용하여 VNF(가상 네트워크 기능)를 호스팅하는 데 도움을 주기 위해 작성되었습니다. 이 가이드에 설명된 단계를 따르면 특정 요구 사항을 충족하는 사용자 지정 Nexus 가상 머신을 빠르고 쉽게 만들 수 있습니다. Nexus 네트워킹의 초보자이든 전문가이든 이 가이드가 도움이 될 것입니다. 가상 네트워크 기능을 호스팅하기 위해 Nexus 가상 머신을 만들고 사용자 지정하기 위해 알아야 할 모든 것을 알아봅니다.

시작하기 전에

Azure를 구독하고 있지 않다면 시작하기 전에 Azure 체험 계정을 만듭니다.

  • 필요한 Azure CLI 확장의 최신 버전을 설치합니다.

  • 이 문서대로 하려면 Azure CLI 버전 2.49.0 이상이 필요합니다. Azure Cloud Shell을 사용하는 경우 최신 버전이 이미 설치되어 있습니다.

  • Azure 구독이 여러 개인 경우 az account 명령을 사용하여 리소스가 청구되어야 하는 적절한 구독 ID를 선택합니다.

  • 가상 머신 만들기를 진행하기 전에 사용할 컨테이너 이미지가 지침에 따라 만들어졌는지 확인합니다.

  • az group create 명령을 사용하여 리소스 그룹을 만듭니다. Azure 리소스 그룹은 Azure 리소스가 배포되고 관리되는 논리 그룹입니다. 리소스 그룹을 만들 때 위치를 지정하라는 메시지가 표시됩니다. 이 위치는 리소스 그룹 메타데이터의 스토리지 위치이며 리소스를 만드는 중에 다른 지역을 지정하지 않은 경우 Azure에서 리소스가 실행되는 위치입니다. 다음 예제에서는 eastus 위치에 myResourceGroup이라는 리소스 그룹을 만듭니다.

    az group create --name myResourceGroup --location eastus
    

    다음 출력 예는 리소스 그룹의 성공적인 만드는 것과 유사합니다.

    {
      "id": "/subscriptions/<guid>/resourceGroups/myResourceGroup",
      "location": "eastus",
      "managedBy": null,
      "name": "myResourceGroup",
      "properties": {
        "provisioningState": "Succeeded"
      },
      "tags": null
    }
    
  • Bicep 파일 또는 ARM 템플릿을 배포하려면 배포하는 리소스에 대한 쓰기 액세스 및 Microsoft.Resources/deployments 리소스 형식의 모든 작업에 대한 액세스가 필요합니다. 예를 들어, 클러스터를 배포하려면 Microsoft.NetworkCloud/virtualMachines/write 및 Microsoft.Resources/deployments/* 권한이 필요합니다. 역할 및 사용 권한 목록은 Azure 기본 제공 역할을 참조하세요.

  • Azure Operator Nexus 클러스터의 custom location 리소스 ID가 필요합니다.

  • 특정 워크로드 요구 사항에 따라 다양한 네트워크를 만들어야 하며 워크로드에 사용할 수 있는 적절한 IP 주소를 확보해야 합니다. 원활한 구현을 위해서는 관련 지원 팀에 문의하여 도움을 받는 것이 좋습니다.

  • Nexus 가상 머신 배포를 위한 필수 조건을 완료합니다.

템플릿 검토

가상 머신 템플릿을 배포하기 전에 콘텐츠를 검토하여 구조를 이해해 보겠습니다.

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "vmName": {
            "type": "string",
            "metadata": {
                "description": "The name of Nexus virtual machine"
            }
        },
        "location": {
            "type": "string",
            "metadata": {
                "description": "The Azure region where the VM is to be deployed"
            },
            "defaultValue": "[resourceGroup().location]"
        },
        "extendedLocation": {
            "type": "string",
            "metadata": {
                "description": "The custom location of the Nexus instance"
            }
        },
        "tags": {
            "type": "object",
            "metadata": {
                "description": "The metadata tags to be associated with the cluster resource"
            },
            "defaultValue": {}
        },
        "adminUsername": {
            "type": "string",
            "defaultValue": "azureuser",
            "maxLength": 32,
            "minLength": 1,
            "metadata": {
                "description": "The name of the administrator to which the ssh public keys will be added into the authorized keys."
            }
        },
        "bootMethod": {
            "type": "string",
            "defaultValue": "UEFI",
            "allowedValues": ["UEFI", "BIOS"],
            "metadata": {
                "description": "Selects the boot method for the virtual machine."
            }
        },
        "cloudServicesNetworkId": {
            "type": "string",
            "metadata": {
                "description": "The Cloud Services Network attachment ARM ID to attach to virtual machine."
            }
        },
        "cpuCores": {
            "type": "int",
            "defaultValue": 2,
            "metadata": {
                "description": "Number of CPU cores for the virtual machine. Choose a value between 2 and 46."
            }
        },
        "memorySizeGB": {
            "type": "int",
            "defaultValue": 4,
            "metadata": {
                "description": "The memory size of the virtual machine in GiB (max 224 GiB)"
            }
        },
        "networkAttachments": {
            "type": "array",
            "metadata": {
                "description": "The list of network attachments to the virtual machine."
            }
            /*
            {
                "attachedNetworkId": "string",
                "defaultGateway": "True"/"False",
                "ipAllocationMethod": "Dynamic"/"Static"/"Disabled",
                "ipv4Address": "string",
                "ipv6Address": "string",
                "networkAttachmentName": "string"
            }
            */
        },
        "networkData": {
            "type": "string",
            "metadata": {
                "description": "The Base64 encoded cloud-init network data."
            },
            "defaultValue": ""
        },
        "placementHints": {
            "type": "array",
            "metadata": {
                "description": "The placement hints for the virtual machine."
            },
            "defaultValue": []
            /*
            {
                "hintType": "Affinity",
                "resourceId": "string",
                "schedulingExecution": "Hard",
                "scope": "Rack"
            }
            */
        },
        "sshPublicKeys": {
            "type": "array",
            "metadata": {
                "description": "The list of SSH public keys for the virtual machine."
            }
            /*
            {
                "keyData": "string"
            }
            */
        },
        "storageProfile": {
            "type": "object",
            "metadata": {
                "description": "StorageProfile represents information about a disk."
            },
            "defaultValue": {
                "osDisk": {
                    "createOption": "Ephemeral",
                    "deleteOption": "Delete",
                    "diskSizeGB": 64
                }
            }
        },
        "userData": {
            "type": "string",
            "metadata": {
                "description": "The Base64 encoded cloud-init user data."
            },
            "defaultValue": ""
        },
        "vmDeviceModel": {
            "type": "string",
            "defaultValue": "T2",
            "allowedValues": ["T1", "T2"],
            "metadata": {
                "description": "The type of the device model to use."
            }
        },
        "vmImage": {
            "type": "string",
            "metadata": {
                "description": "The virtual machine image that is currently provisioned to the OS disk, using the full URL and tag notation used to pull the image."
            }
        },
        "vmImageRepositoryCredentials": {
            "type": "object",
            "metadata": {
                "description": "Credentials used to login to the image repository."
            }
            /*
                "password": "string",
                "registryUrl": "string",
                "username": "string"
            */
        }
    },
    "resources": [
        {
            "type": "Microsoft.NetworkCloud/virtualMachines",
            "apiVersion": "2023-07-01",
            "name": "[parameters('vmName')]",
            "location": "[parameters('location')]",
            "extendedLocation": {
                "type": "CustomLocation",
                "name": "[parameters('extendedLocation')]"
            },
            "tags": "[parameters('tags')]",
            "properties": {
                "adminUsername": "[if(empty(parameters('adminUsername')), json('null'), parameters('adminUsername'))]",
                "bootMethod": "[if(empty(parameters('bootMethod')), json('null'), parameters('bootMethod'))]",
                "cloudServicesNetworkAttachment": {
                    "attachedNetworkId": "[parameters('cloudServicesNetworkId')]",
                    "defaultGateway": "False",
                    "ipAllocationMethod": "Dynamic"
                },
                "cpuCores": "[parameters('cpuCores')]",
                "memorySizeGB": "[parameters('memorySizeGB')]",
                "networkData": "[if(empty(parameters('networkData')), json('null'), parameters('networkData'))]",
                "networkAttachments": "[if(empty(parameters('networkAttachments')), json('null'), parameters('networkAttachments'))]",
                "placementHints": "[if(empty(parameters('placementHints')), json('null'), parameters('placementHints'))]",
                "sshPublicKeys": "[if(empty(parameters('sshPublicKeys')), json('null'), parameters('sshPublicKeys'))]",
                "storageProfile": "[if(empty(parameters('storageProfile')), json('null'), parameters('storageProfile'))]",
                "userData": "[if(empty(parameters('userData')), json('null'), parameters('userData'))]",
                "vmDeviceModel": "[if(empty(parameters('vmDeviceModel')), json('null'), parameters('vmDeviceModel'))]",
                "vmImage": "[if(empty(parameters('vmImage')), json('null'), parameters('vmImage'))]",
                "vmImageRepositoryCredentials": "[if(empty(parameters('vmImageRepositoryCredentials')), json('null'), parameters('vmImageRepositoryCredentials'))]"
            }
        }
    ]
  }

virtual-machine-arm-template.json이라는 템플릿 파일을 검토하고 저장한 후 다음 섹션으로 진행하여 템플릿을 배포합니다.

템플릿 배포

  1. virtual-machine-parameters.json이라는 파일을 만들고 JSON 형식으로 필수 매개 변수를 추가합니다. 다음 예를 시작점으로 사용할 수 있습니다. 사용자 고유의 값으로 대체합니다.
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
      "vmName": {
        "value": "myNexusVirtualMachine"
      },
      "location": {
        "value": "eastus"
      },
      "extendedLocation": {
        "value": "/subscriptions/<subscription>/resourcegroups/<cluster-managed-resource-group>/providers/microsoft.extendedlocation/customlocations/<custom-location-name>"
      },
      "cloudServicesNetworkId": {
          "value": "/subscriptions/<subscription>/resourceGroups/<network-resource-group>/providers/Microsoft.NetworkCloud/cloudServicesNetworks/<csn-name>"
      },
      "networkAttachments": {
          "value": [
            {
                "attachedNetworkId": "/subscriptions/<subscription>/resourceGroups/<network-resource-group>/providers/Microsoft.NetworkCloud/l3Networks/<l3network-name>",
                "ipAllocationMethod": "Dynamic",
                "defaultGateway": "True",
                "networkAttachmentName": "mgmt0"
            }
        ]
      },
      "sshPublicKeys": {
          "value": [
            {
                "keyData": "ssh-rsa AAAAB3...."
            }
        ]
      },
      "vmImage": {
          "value": "<Image ACR URL>"
      },
      "vmImageRepositoryCredentials": {
          "value": {
              "password": "********************",
              "registryUrl": "<ACR registry URL>",
              "username": "<ACR user name>"
          }
      }
    }
  }
  1. 템플릿을 배포합니다.
    az deployment group create --resource-group myResourceGroup --template-file virtual-machine-arm-template.json --parameters @virtual-machine-parameters.json

배포된 리소스 검토

배포가 완료되면 CLI 또는 Azure Portal을 사용하여 리소스를 볼 수 있습니다.

myResourceGroup 리소스 그룹에 있는 myNexusVirtualMachine 클러스터의 세부 정보를 보려면 다음을 실행합니다.

az networkcloud virtualmachine show --name myNexusVirtualMachine --resource-group myResourceGroup

리소스 정리

더 이상 필요하지 않은 경우 리소스 그룹을 삭제합니다. 리소스 그룹 및 리소스 그룹의 모든 리소스가 삭제됩니다.

리소스 그룹, 가상 머신 및 Operator Nexus 네트워크 리소스를 제외한 모든 관련 리소스를 제거하려면 az group delete 명령을 사용합니다.

az group delete --name myResourceGroup --yes --no-wait

다음 단계

Nexus 가상 머신이 성공적으로 만들어졌습니다. 이제 가상 머신을 사용하여 VNF(가상 네트워크 기능)를 호스팅할 수 있습니다.