빠른 시작: ARM 템플릿을 사용하여 App Service 앱 만들기

ARM 템플릿(Azure Resource Manager 템플릿) 및 Cloud Shell의 Azure CLI를 사용하여 클라우드에 앱을 배포하여 Azure App Service를 시작하세요. Resource Manager 템플릿은 프로젝트에 대한 인프라 및 구성을 정의하는 JSON(JavaScript Object Notation) 파일입니다. 무료 App Service 계층을 사용하기 때문에 이 빠른 시작을 완료하는 데 비용이 발생하지 않습니다.

이 빠른 시작을 완료하려면 활성 구독이 있는 Azure 계정이 필요합니다. Azure 계정이 없으면 무료 계정을 만들 수 있습니다.

끝까지 건너뛰기

ARM 템플릿을 사용하는 데 익숙한 경우 이 Button to deploy the Resource Manager template to Azure. 단추를 선택하여 끝으로 건너뛸 수 있습니다. 이 단추는 Azure Portal에서 ARM 템플릿을 엽니다.

Screenshot of the ARM Template in the Azure portal.

Azure Portal에서 새로 만들기를 선택하여 새 리소스 그룹을 만든 다음 검토 + 만들기 단추를 선택하여 앱을 배포합니다.

ARM 템플릿(Azure Resource Manager 템플릿) 및 Cloud Shell의 Azure CLI를 사용하여 클라우드에 앱을 배포하여 Azure App Service를 시작하세요. Resource Manager 템플릿은 프로젝트에 대한 인프라 및 구성을 정의하는 JSON(JavaScript Object Notation) 파일입니다. 무료 App Service 계층을 사용하기 때문에 이 빠른 시작을 완료하는 데 비용이 발생하지 않습니다.

이 빠른 시작을 완료하려면 활성 구독이 있는 Azure 계정이 필요합니다. Azure 계정이 없으면 무료 계정을 만들 수 있습니다.

끝까지 건너뛰기

ARM 템플릿을 사용하는 데 익숙한 경우 이 Button to deploy the Resource Manager template to Azure. 단추를 선택하여 끝으로 건너뛸 수 있습니다. 이 단추는 Azure Portal에서 ARM 템플릿을 엽니다.

Screenshot of the ARM Template in the Azure portal.

Azure Portal에서 새로 만들기를 선택하여 새 리소스 그룹을 만든 다음 검토 + 만들기 단추를 선택하여 앱을 배포합니다.

ARM 템플릿(Azure Resource Manager 템플릿) 및 Cloud Shell의 Azure CLI를 사용하여 클라우드에 앱을 배포하여 Azure App Service를 시작하세요. Resource Manager 템플릿은 프로젝트에 대한 인프라 및 구성을 정의하는 JSON(JavaScript Object Notation) 파일입니다. Windows 컨테이너 앱을 배포하려면 프리미엄 플랜이 필요합니다. 가격 책정 세부 정보는 App Service 가격 책정 페이지를 참조하세요.

끝까지 건너뛰기

ARM 템플릿을 사용하는 데 익숙한 경우 이 Button to deploy the Resource Manager template to Azure. 단추를 선택하여 끝으로 건너뛸 수 있습니다. 이 단추는 Azure Portal에서 ARM 템플릿을 엽니다.

Screenshot of the ARM Template in the Azure portal.

Azure Portal에서 새로 만들기를 선택하여 새 리소스 그룹을 만든 다음 검토 + 만들기 단추를 선택하여 앱을 배포합니다.

템플릿 검토

이 빠른 시작에서 사용되는 템플릿은 Azure 빠른 시작 템플릿에서 나온 것입니다. Windows에 App Service 요금제 및 App Service 앱을 배포합니다. .NET Core, .NET Framework, PHP, Node.js 및 정적 HTML 앱과 호환됩니다. Java의 경우 Java 앱 만들기를 참조하세요.

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "metadata": {
    "_generator": {
      "name": "bicep",
      "version": "0.25.53.49325",
      "templateHash": "16144177164140676603"
    }
  },
  "parameters": {
    "webAppName": {
      "type": "string",
      "defaultValue": "[format('webApp-{0}', uniqueString(resourceGroup().id))]",
      "minLength": 2,
      "metadata": {
        "description": "Web app name."
      }
    },
    "location": {
      "type": "string",
      "defaultValue": "[resourceGroup().location]",
      "metadata": {
        "description": "Location for all resources."
      }
    },
    "sku": {
      "type": "string",
      "defaultValue": "F1",
      "metadata": {
        "description": "The SKU of App Service Plan."
      }
    },
    "language": {
      "type": "string",
      "defaultValue": ".net",
      "allowedValues": [
        ".net",
        "php",
        "node",
        "html"
      ],
      "metadata": {
        "description": "The language stack of the app."
      }
    },
    "helloWorld": {
      "type": "bool",
      "defaultValue": false,
      "metadata": {
        "description": "true = deploy a sample Hello World app."
      }
    },
    "repoUrl": {
      "type": "string",
      "defaultValue": "",
      "metadata": {
        "description": "Optional Git Repo URL"
      }
    }
  },
  "variables": {
    "appServicePlanPortalName": "[format('AppServicePlan-{0}', parameters('webAppName'))]",
    "gitRepoReference": {
      ".net": "https://github.com/Azure-Samples/app-service-web-dotnet-get-started",
      "node": "https://github.com/Azure-Samples/nodejs-docs-hello-world",
      "php": "https://github.com/Azure-Samples/php-docs-hello-world",
      "html": "https://github.com/Azure-Samples/html-docs-hello-world"
    },
    "gitRepoUrl": "[if(bool(parameters('helloWorld')), variables('gitRepoReference')[toLower(parameters('language'))], parameters('repoUrl'))]",
    "configReference": {
      ".net": {
        "comments": ".Net app. No additional configuration needed."
      },
      "html": {
        "comments": "HTML app. No additional configuration needed."
      },
      "php": {
        "phpVersion": "7.4"
      },
      "node": {
        "appSettings": [
          {
            "name": "WEBSITE_NODE_DEFAULT_VERSION",
            "value": "12.15.0"
          }
        ]
      }
    }
  },
  "resources": [
    {
      "type": "Microsoft.Web/serverfarms",
      "apiVersion": "2023-01-01",
      "name": "[variables('appServicePlanPortalName')]",
      "location": "[parameters('location')]",
      "sku": {
        "name": "[parameters('sku')]"
      }
    },
    {
      "type": "Microsoft.Web/sites",
      "apiVersion": "2023-01-01",
      "name": "[parameters('webAppName')]",
      "location": "[parameters('location')]",
      "identity": {
        "type": "SystemAssigned"
      },
      "properties": {
        "siteConfig": "[variables('configReference')[parameters('language')]]",
        "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('appServicePlanPortalName'))]",
        "httpsOnly": true
      },
      "dependsOn": [
        "[resourceId('Microsoft.Web/serverfarms', variables('appServicePlanPortalName'))]"
      ]
    },
    {
      "condition": "[contains(variables('gitRepoUrl'), 'http')]",
      "type": "Microsoft.Web/sites/sourcecontrols",
      "apiVersion": "2023-01-01",
      "name": "[format('{0}/{1}', parameters('webAppName'), 'web')]",
      "properties": {
        "repoUrl": "[variables('gitRepoUrl')]",
        "branch": "master",
        "isManualIntegration": true
      },
      "dependsOn": [
        "[resourceId('Microsoft.Web/sites', parameters('webAppName'))]"
      ]
    }
  ]
}

템플릿에는 두 개의 Azure 리소스가 정의되어 있습니다.

이 템플릿에는 편의를 위해 미리 정의된 몇 가지 매개 변수가 포함되어 있습니다. 매개 변수 기본값 및 해당 설명은 테이블을 참조하세요.

매개 변수 Type 기본값 설명
webAppName string webApp-<uniqueString> 고유한 문자열 값을 기반으로 하는 앱 이름
appServicePlanName string webAppPlan-<uniqueString> 고유한 문자열 값을 기반으로 하는 App Service 계획 이름
location string [resourceGroup().location] 앱 지역
sku string F1 인스턴스 크기(F1 = 무료 계층)
언어 string .NET 프로그래밍 언어 스택(.NET, php, node, html)
helloWorld 부울 값 False True = "Hello World" 앱 배포
repoUrl string 외부 Git 리포지토리(선택 사항)

이 빠른 시작에서 사용되는 템플릿은 Azure 빠른 시작 템플릿에서 나온 것입니다. Linux에 App Service 요금제 및 App Service 앱을 배포합니다. App Service에서 지원되는 모든 프로그래밍 언어와 호환됩니다.

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "metadata": {
    "_generator": {
      "name": "bicep",
      "version": "0.5.6.12127",
      "templateHash": "10602523904429381366"
    }
  },
  "parameters": {
    "webAppName": {
      "type": "string",
      "defaultValue": "[format('webApp-{0}', uniqueString(resourceGroup().id))]",
      "minLength": 2,
      "metadata": {
        "description": "Web app name."
      }
    },
    "location": {
      "type": "string",
      "defaultValue": "[resourceGroup().location]",
      "metadata": {
        "description": "Location for all resources."
      }
    },
    "sku": {
      "type": "string",
      "defaultValue": "F1",
      "metadata": {
        "description": "The SKU of App Service Plan."
      }
    },
    "linuxFxVersion": {
      "type": "string",
      "defaultValue": "DOTNETCORE|3.0",
      "metadata": {
        "description": "The Runtime stack of current web app"
      }
    },
    "repoUrl": {
      "type": "string",
      "defaultValue": " ",
      "metadata": {
        "description": "Optional Git Repo URL"
      }
    }
  },
  "variables": {
    "appServicePlanPortalName": "[format('AppServicePlan-{0}', parameters('webAppName'))]"
  },
  "resources": [
    {
      "type": "Microsoft.Web/serverfarms",
      "apiVersion": "2021-02-01",
      "name": "[variables('appServicePlanPortalName')]",
      "location": "[parameters('location')]",
      "sku": {
        "name": "[parameters('sku')]"
      },
      "kind": "linux",
      "properties": {
        "reserved": true
      }
    },
    {
      "type": "Microsoft.Web/sites",
      "apiVersion": "2021-02-01",
      "name": "[parameters('webAppName')]",
      "location": "[parameters('location')]",
      "properties": {
        "httpsOnly": true,
        "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('appServicePlanPortalName'))]",
        "siteConfig": {
          "linuxFxVersion": "[parameters('linuxFxVersion')]",
          "minTlsVersion": "1.2",
          "ftpsState": "FtpsOnly"
        }
      },
      "identity": {
        "type": "SystemAssigned"
      },
      "dependsOn": [
        "[resourceId('Microsoft.Web/serverfarms', variables('appServicePlanPortalName'))]"
      ]
    },
    {
      "condition": "[contains(parameters('repoUrl'), 'http')]",
      "type": "Microsoft.Web/sites/sourcecontrols",
      "apiVersion": "2021-02-01",
      "name": "[format('{0}/{1}', parameters('webAppName'), 'web')]",
      "properties": {
        "repoUrl": "[parameters('repoUrl')]",
        "branch": "master",
        "isManualIntegration": true
      },
      "dependsOn": [
        "[resourceId('Microsoft.Web/sites', parameters('webAppName'))]"
      ]
    }
  ]
}

템플릿에는 두 개의 Azure 리소스가 정의되어 있습니다.

이 템플릿에는 편의를 위해 미리 정의된 몇 가지 매개 변수가 포함되어 있습니다. 매개 변수 기본값 및 해당 설명은 테이블을 참조하세요.

매개 변수 Type 기본값 설명
webAppName string webApp-<uniqueString> 고유한 문자열 값을 기반으로 하는 앱 이름
appServicePlanName string webAppPlan-<uniqueString> 고유한 문자열 값을 기반으로 하는 App Service 계획 이름
location string [resourceGroup().location] 앱 지역
sku string F1 인스턴스 크기(F1 = 무료 계층)
linuxFxVersion string DOTNETCORE|3.0 “프로그래밍 언어 스택 | 버전”
repoUrl string 외부 Git 리포지토리(선택 사항)

이 빠른 시작에서 사용되는 템플릿은 Azure 빠른 시작 템플릿에서 나온 것입니다. Windows 컨테이너에 App Service 요금제 및 App Service 앱을 배포합니다.

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "metadata": {
    "_generator": {
      "name": "bicep",
      "version": "0.25.53.49325",
      "templateHash": "10193476814580854111"
    }
  },
  "parameters": {
    "appServiceWebAppName": {
      "type": "string",
      "defaultValue": "[format('webApp-{0}', uniqueString(resourceGroup().id))]",
      "minLength": 2,
      "metadata": {
        "description": "Web App name."
      }
    },
    "appServicePlanName": {
      "type": "string",
      "defaultValue": "[format('webApp-{0}', uniqueString(resourceGroup().id))]",
      "minLength": 2,
      "metadata": {
        "description": "App Service Plan name."
      }
    },
    "skuTier": {
      "type": "string",
      "defaultValue": "P1v3"
    },
    "location": {
      "type": "string",
      "defaultValue": "[resourceGroup().location]"
    }
  },
  "resources": [
    {
      "type": "Microsoft.Web/sites",
      "apiVersion": "2023-01-01",
      "name": "[parameters('appServiceWebAppName')]",
      "location": "[parameters('location')]",
      "tags": {
        "[format('hidden-related:{0}', resourceId('Microsoft.Web/serverfarms', parameters('appServicePlanName')))]": "empty"
      },
      "properties": {
        "siteConfig": {
          "appSettings": [
            {
              "name": "PORT",
              "value": "8080"
            }
          ],
          "appCommandLine": "",
          "windowsFxVersion": "DOCKER|mcr.microsoft.com/dotnet/samples:aspnetapp"
        },
        "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('appServicePlanName'))]"
      },
      "dependsOn": [
        "[resourceId('Microsoft.Web/serverfarms', parameters('appServicePlanName'))]"
      ]
    },
    {
      "type": "Microsoft.Web/serverfarms",
      "apiVersion": "2023-01-01",
      "name": "[parameters('appServicePlanName')]",
      "location": "[parameters('location')]",
      "sku": {
        "name": "[parameters('skuTier')]"
      },
      "kind": "windows",
      "properties": {
        "hyperV": true
      }
    }
  ]
}

템플릿에는 두 개의 Azure 리소스가 정의되어 있습니다.

이 템플릿에는 편의를 위해 미리 정의된 몇 가지 매개 변수가 포함되어 있습니다. 매개 변수 기본값 및 해당 설명은 테이블을 참조하세요.

매개 변수 Type 기본값 설명
webAppName string webApp-<uniqueString> 고유한 문자열 값을 기반으로 하는 앱 이름
appServicePlanName string webAppPlan-<uniqueString> 고유한 문자열 값을 기반으로 하는 App Service 계획 이름
location string [resourceGroup().location] 앱 지역
skuTier string P1v3 인스턴스 크기(사용 가능한 SKU 보기)
appSettings string [{"name": "PORT","value": "8080"}] App Service 수신 대기 포트입니다. 8080이어야 합니다.
kind string windows 운영 체제
hyperv string true 격리 모드
windowsFxVersion string DOCKER|mcr.microsoft.com/dotnet/samples:aspnetapp 컨테이너 이미지

템플릿 배포

Azure CLI는 템플릿을 배포하는 데 사용됩니다. Azure Portal, Azure PowerShell 및 REST API를 사용할 수도 있습니다. 다른 배포 방법을 알아보려면 템플릿 배포를 참조하세요.

다음 코드는 리소스 그룹, App Service 요금제 및 웹앱을 만듭니다. 기본 리소스 그룹, App Service 요금제 및 위치가 설정되었습니다. <app-name>을 전역적으로 고유한 앱 이름(유효한 문자: a-z, 0-9, -)으로 바꿉니다.

다음 명령을 실행하여 Windows에서 .NET Framework 앱을 배포합니다.

az group create --name myResourceGroup --location "southcentralus"

az deployment group create --resource-group myResourceGroup \
--parameters language=".NET" helloWorld="true" webAppName="<app-name>" \
--template-uri "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/quickstarts/microsoft.web/app-service-docs-windows/azuredeploy.json"

다음 명령을 실행하여 Linux에서 Python 앱을 만듭니다.

az group create --name myResourceGroup --location "southcentralus"

az deployment group create --resource-group myResourceGroup --parameters webAppName="<app-name>" linuxFxVersion="PYTHON|3.9" \
--template-uri "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/quickstarts/microsoft.web/app-service-docs-linux/azuredeploy.json"

다른 언어 스택을 배포하려면 linuxFxVersion을 적절한 값으로 업데이트합니다. 샘플은 표에 나와 있습니다. 최신 버전을 표시하려면 Cloud Shell에서 다음 명령어를 실행합니다. az webapp config show --resource-group myResourceGroup --name <app-name> --query linuxFxVersion

언어 예시
.NET linuxFxVersion=“DOTNETCORE|3.0”
PHP linuxFxVersion=“PHP|7.4”
Node.JS linuxFxVersion=“NODE|10.15”
Java linuxFxVersion=“JAVA|1.8 |TOMCAT|9.0”
Python linuxFxVersion=“PYTHON|3.7”

다음 명령을 실행하여 Windows 컨테이너에 .NET 앱을 배포합니다.

az group create --name myResourceGroup --location "southcentralus"

az deployment group create --resource-group myResourceGroup \
--parameters webAppName="<app-name>" \
--template-uri "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/quickstarts/microsoft.web/app-service-docs-windows-container/azuredeploy.json"

참고 항목

자세한 내용은 Azure App Service 템플릿 샘플에서 확인할 수 있습니다.

배포 유효성 검사

http://<app_name>.azurewebsites.net/으로 이동하여 생성되었는지 확인합니다.

Screenshot of the Windows code experience.

Screenshot of the Linux experience.

Screenshot of the Windows container experience.

리소스 정리

더 이상 필요하지 않은 경우 리소스 그룹을 삭제합니다.

다음 단계