[Azure] Sample App Service

Blog นี้เป็น Note ที่ลองเล่น Azure และแปะ Command กับอธิบายนิดหน่อย

Static HTML web app

az webapp up --location <myLocation> --name <myAppName> --html

az webapp up --location centralus --name pingapp20220213 --html
  • Result หลังจาก az webapp up มันจะตรวจสอบว่ามี app pingapp20220213 ถ้าไม่มีสร้างใหม่ ยกชุดพร้อม Resource Group เลย (กรณี ถ้ามีซ้ำมันจะลบออก)
The webapp 'pingapp20220213' doesn't exist
Creating Resource group 'Chatri_Ngambenchawong_rg_5809' ...
Resource group creation complete
Creating AppServicePlan 'Chatri_Ngambenchawong_asp_1072' ...
Creating webapp 'pingapp20220213' ...
Configuring default logging for the app, if not already enabled
Creating zip with contents of dir /home/chatri_ngambenchawong/htmlapp/html-docs-hello-world ...
Getting scm site credentials for zip deployment
Starting zip deployment. This operation can take a while to complete ...
Deployment endpoint responded with status code 202
You can launch the app at http://pingapp20220213.azurewebsites.net
Setting 'az webapp up' default arguments for current directory. Manage defaults with 'az configure --scope local'
--resource-group/-g default: Chatri_Ngambenchawong_rg_5809
--sku default: F1
--plan/-p default: Chatri_Ngambenchawong_asp_1072
--location/-l default: centralus
--name/-n default: pingapp20220213
{
  "URL": "http://pingapp20220213.azurewebsites.net",
  "appserviceplan": "Chatri_Ngambenchawong_asp_1072",
  "location": "centralus",
  "name": "pingapp20220213",
  "os": "Windows",
  "resourcegroup": "Chatri_Ngambenchawong_rg_5809",
  "runtime_version": "-",
  "runtime_version_detected": "-",
  "sku": "FREE",
  "src_path": "//home//chatri_ngambenchawong//htmlapp//html-docs-hello-world"
}
  • ลองเข้าทดสอบ มันบอก json resource บอก URL http://pingapp20220213.azurewebsites.net ลองทดสอบได้
  • อ่อ อย่าลืม Cleanup Resource ออกนะ เดี๋ยวมันคิดเงิน
az group delete --name <resource_group> --no-wait

az group delete --name Chatri_Ngambenchawong_rg_5809 --no-wait

Issue Note

  • ลอง Location southeastasia มันจะฟ้อง This region has quota of 0 instances for your subscription. Try selecting different region or SKU.
    วิธีแก้ เปลี่ยน Location เอา
  • Azure CLI บน Azure Portal ต้องทำ Storage Account ด้วย อาจจะมีค่าใช้จ่ายเพิ่ม

Discover more from naiwaen@DebuggingSoft

Subscribe to get the latest posts sent to your email.