Chuyển tới nội dung chính

App Services / Functions / Container Apps

Platform Selection

PlatformUse CasePricing ModelScalability
App ServiceWeb apps, APIsFixed planManual/Auto
FunctionsEvent-driven, microservicesConsumption/PremiumAuto
Container AppsMicroservices, containerized appsUsage-basedAuto (KEDA)

App Service

Create Web App

# Create App Service Plan
New-AzAppServicePlan -Name "MyPlan" `
-ResourceGroupName "MyRG" `
-Location "East Asia" `
-Tier "Standard" `
-NumberofWorkers 2

# Create Web App
New-AzWebApp -Name "myapp" `
-ResourceGroupName "MyRG" `
-Location "East Asia" `
-AppServicePlan "MyPlan"

Azure Functions

HTTP Trigger Example

[FunctionName("HttpTrigger")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post")] HttpRequest req,
ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
return new OkObjectResult("Hello from Azure Functions!");
}

Container Apps

Deploy Container App

# Create Container Apps environment
az containerapp env create \
--name myenvironment \
--resource-group MyRG \
--location eastasia

# Deploy container app
az containerapp create \
--name myapp \
--resource-group MyRG \
--environment myenvironment \
--image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest \
--target-port 80 \
--ingress external

Next Steps