Share via


빠른 시작: Azure CLI를 사용하여 Azure Spring Apps 프로비저닝

참고 항목

Azure Spring Apps는 Azure Spring Cloud 서비스의 새 이름입니다. 서비스에 새 이름이 지정되었지만, 자산을 업데이트하는 동안 스크린샷, 비디오, 다이어그램과 같은 일부 위치에서는 당분간 이전 이름이 표시됩니다.

이 문서의 적용 대상:❌ 기본 ✔️ 표준 ✔️ 엔터프라이즈

이 빠른 시작에서는 Azure CLI를 사용하여 기존 가상 네트워크에 Azure Spring Apps 클러스터를 배포하는 방법을 설명합니다.

Azure Spring Apps를 사용하면 코드 변경 없이 Spring 애플리케이션을 Azure에 쉽게 배포할 수 있습니다. 이 서비스는 개발자가 코드에 집중할 수 있도록 Spring 애플리케이션의 인프라를 관리합니다. Azure Spring Apps는 포괄적인 모니터링 및 진단, 구성 관리, 서비스 검색, CI/CD 통합, 파란색-녹색 배포 등을 사용하여 수명 주기 관리를 제공합니다.

엔터프라이즈 배포 계획에는 다음과 같은 Tanzu 구성 요소가 포함됩니다.

  • Build Service
  • Application Configuration Service
  • 서비스 레지스트리
  • Spring Cloud Gateway
  • API 포털

필수 구성 요소

Azure CLI 배포 스크립트 검토

이 빠른 시작에 사용된 배포 스크립트는 Azure Spring Apps 참조 아키텍처에서 가져왔습니다.

#!/bin/bash

echo "Enter Azure Subscription ID: "
read subscription
subscription=$subscription

echo "Enter Azure region for resource deployment: "
read region
location=$region

echo "Enter Azure Spring  Resource Group Name: "
read azurespringrg
azurespring_resource_group_name=$azurespringrg

echo "Enter Azure Spring VNet Resource Group Name: "
read azurespringvnetrg
azurespring_vnet_resource_group_name=$azurespringvnetrg

echo "Enter Azure Spring Spoke VNet : "
read azurespringappspokevnet
azurespringappspokevnet=$azurespringappspokevnet

echo "Enter Azure Spring App SubNet : "
read azurespringappsubnet
azurespring_app_subnet_name='/subscriptions/'$subscription'/resourcegroups/'$azurespring_vnet_resource_group_name'/providers/Microsoft.Network/virtualNetworks/'$azurespringappspokevnet'/subnets/'$azurespringappsubnet

echo "Enter Azure Spring Service SubNet : "
read azurespringservicesubnet
azurespring_service_subnet_name='/subscriptions/'$subscription'/resourcegroups/'$azurespring_vnet_resource_group_name'/providers/Microsoft.Network/virtualNetworks/'$azurespringappspokevnet'/subnets/'$azurespringservicesubnet

echo "Enter Azure Log Analytics Workspace Resource Group Name: "
read loganalyticsrg
loganalyticsrg=$loganalyticsrg

echo "Enter Log Analytics Workspace Resource ID: "
read workspace
workspaceID='/subscriptions/'$subscription'/resourcegroups/'$loganalyticsrg'/providers/microsoft.operationalinsights/workspaces/'$workspace

echo "Enter Reserved CIDR Ranges for Azure Spring: "
read reservedcidrrange
reservedcidrrange=$reservedcidrrange

echo "Enter key=value pair used for tagging Azure Resources (space separated for multiple tags): "
read tag
tags=$tag

randomstring=$(LC_ALL=C tr -dc 'a-z0-9' < /dev/urandom | fold -w 13 | head -n 1)
azurespring_service='spring-'$randomstring #Name of unique Spring resource
azurespring_appinsights=$azurespring_service
azurespring_resourceid='/subscriptions/'$subscription'/resourceGroups/'$azurespring_resource_group_name'/providers/Microsoft.AppPlatform/Spring/'$azurespring_service

# Create Application Insights
az monitor app-insights component create \
    --app ${azurespring_service} \
    --location ${location} \
    --kind web \
    -g ${azurespringrg} \
    --application-type web \
    --workspace ${workspaceID}

az spring create \
    -n ${azurespring_service} \
    -g ${azurespringrg} \
    -l ${location} \
    --sku Enterprise \
    --build-pool-size S1 \
    --enable-application-configuration-service \
    --enable-service-registry \
    --enable-gateway \
    --enable-api-portal \
    --api-portal-instance-count 2 \
    --enable-java-agent true \
    --app-insights ${azurespring_service} \
    --app-subnet ${azurespring_app_subnet_name} \
    --service-runtime-subnet ${azurespring_service_subnet_name} \
    --reserved-cidr-range ${reservedcidrrange} \
    --tags ${tags}

# Update diagnostic setting for Azure Spring instance
az monitor diagnostic-settings create  \
   --name monitoring \
   --resource ${azurespring_resourceid} \
   --logs    '[{"category": "ApplicationConsole","enabled": true}]' \
   --workspace  ${workspaceID}

클러스터 배포

Azure CLI 스크립트를 사용하여 Azure Spring Apps 클러스터를 배포하려면 다음 단계를 따릅니다.

  1. 다음 명령을 사용하여 Azure에 로그인합니다.

    az login
    

    로그인한 후에 이 명령은 사용자에게 액세스 권한이 있는 모든 구독에 대한 정보를 출력합니다. 사용할 구독의 이름과 ID를 적어둡니다.

  2. 대상 구독을 설정합니다.

    az account set --subscription "<your subscription name>"
    
  3. Azure Spring Apps 리소스 공급자를 등록합니다.

    az provider register --namespace 'Microsoft.AppPlatform'
    
  4. Azure CLI에 필요한 확장을 추가합니다.

    az extension add --name spring
    
  5. 지역별 사용 가능한 제품에 표시된 대로 Azure Spring Apps를 사용할 수 있는 지역의 배포 위치를 선택합니다.

  6. 다음 명령을 사용하여 Azure 위치 목록을 생성합니다. 이전 단계에서 선택한 지역에 대한 짧은 이름 값을 적어둡니다.

    az account list-locations --output table
    
  7. 리소스를 배포할 리소스 그룹을 만듭니다.

    az group create --name <your-resource-group-name> --location <location-name>
    
  8. Azure Spring Apps 표준 계획 또는 엔터프라이즈 계획용 스크립트를 로컬에 저장한 다음 Bash 프롬프트에서 실행합니다.

    표준 계획

    ./azuredeploySpringStandard.sh
    

    엔터프라이즈 계획

    ./azuredeploySpringEnterprise.sh
    
  9. 스크립트에서 요구할 경우 다음 값을 입력합니다.

    • 이전에 저장한 Azure 구독 ID
    • 이전에 저장한 Azure 위치 이름
    • 이전에 만든 리소스 그룹의 이름
    • 리소스를 배포할 가상 네트워크 리소스 그룹의 이름
    • 스포크 가상 네트워크의 이름(예: vnet-spoke)
    • Azure Spring Apps 애플리케이션 서비스에서 사용할 서브넷의 이름(예: snet-app)입니다.
    • Azure Spring Apps 런타임 서비스에서 사용할 서브넷의 이름(예: snet-runtime).
    • Azure Log Analytics 작업 영역이 진단 로그를 저장하는 데 사용할 리소스 그룹의 이름
    • Azure Log Analytics 작업 영역의 이름(예: la-cb5sqq6574o2a)
    • Azure Spring Apps에서 사용할 가상 네트워크의 CIDR 범위(예: XX.X.X.X/16,XX.X.X.X/16,XX.X.X.X/16)
    • 태그를 지원하는 모든 리소스에서 태그로 적용할 키/값 쌍. 자세한 내용은 태그를 사용하여 Azure 리소스 및 관리 계층 구조 구성을 참조하세요. 여러 태그를 적용하려면 공백으로 구분된 목록을 사용합니다(예: environment=Dev BusinessUnit=finance).

이 정보를 입력하면 스크립트에서 Azure 리소스를 만들고 배포합니다.

배포된 리소스 검토

Azure Portal을 사용하여 배포된 리소스를 확인하거나 Azure CLI를 사용하여 배포된 리소스를 나열할 수 있습니다.

리소스 정리

후속 빠른 시작 및 자습서를 계속 사용하려는 경우 이러한 리소스를 그대로 유지할 수 있습니다. 더 이상 필요 없으면 리소스 그룹을 삭제합니다. 그러면 리소스 그룹의 리소스가 삭제됩니다. Azure CLI를 사용하여 리소스 그룹을 삭제하려면 다음 명령을 사용합니다.

echo "Enter the Resource Group name:" &&
read resourceGroupName &&
az group delete --name $resourceGroupName &&
echo "Press [ENTER] to continue ..."

다음 단계

이 빠른 시작에서는 Azure CLI를 사용하여 기존 가상 네트워크에 Azure Spring Apps 인스턴스를 배포한 후 배포의 유효성을 검사했습니다. Azure Spring Apps에 대해 자세히 알아보려면 아래 리소스를 계속 진행합니다.