Thi's avatar
HomeAboutNotesBlogTopicsToolsReading
About|My sketches |Cooking |Cafe icon Support Thi
💌 [email protected]

Azure things

Anh-Thi Dinh
draft
Data EngineeringAPI & ServicesWeb DevAzure
Left aside
⚠️
This is a quick & dirty draft, for me only!

References

  • az | Microsoft Learn (Azure CLI)
  • Deploy a Flask or FastAPI web app as a container in Azure App Service
  • Understanding the Azure App Service file system · projectkudu/kudu Wiki
  • Welcome | Azure Tips and Tricks
  • azureossd.github.io

Bash / SSH to current App Service

  • SSH access for Linux and Windows containers - Azure App Service | Microsoft Learn
  • SSH access for Linux and Windows containers - Azure App Service | Microsoft Learn
  • In the current app service → Development Tools → Advanced Tools → “Go →” → (KUDU console opens) → There is a menu on the top bar!
Click “SSH”. Please note the line “Note: Any data outside ‘/home’ is not persisted”
  • We can use SSH to go inside the App Service container.
    • ☝️
      We can install new package inside App Service container via apt install ffmpeg but after re-deploy, everything installed isn’t persisted. Inside this SSH, it also says that “Any data outside /home is not persisted”! ← one SO.
    • SSH access for Linux and Windows containers - Azure App Service | Microsoft Learn
  • Using CLI to ssh to App Service container
  • Good to read: Enabling SSH on Linux Web App for Containers
  • To open SSH from remote shell, read this.

Check quota

Azure Portal → Subscriptions → (choose a subscription) → Usage + quotas

Install custom packages / dependencies into current App Service

  • Bring dependencies and third-party libraries to Azure Functions | Microsoft Learn
  • Function App custom dependencies, how to install and reference python packages locally? - Stack Overflow
  • Enter App Service container and using SSH ← not persisted
    • ☝️
      We can install new package inside App Service container via apt install ffmpeg but after re-deploy, everything installed isn’t persisted. Inside this SSH, it also says that “Any data outside /home is not persisted”! ← one SO.

Push local image to ACR

ACR = Azure Container Registry.
Official doc: Push your first image to your Azure container registry using the Docker CLI

Health check

Azure sẽ gởi pingpong đến 1 endpoint tạo trên server để check status của nó. Thường app service sẽ chạy trên nhiều instances khác nhau, instance nào die thì cái health check này sẽ hiển thị. Official doc.
Location: Home → App Services → <service name> → Monitoring → Health check
Trong đây có chỗ “Health probe path” để điền endpoint cần vào.
Home → App Services → <service name> → Monitoring → Health check
 
Còn cái này là coi xem giai đoạn nào server trục trặc (timestamp). Nó nằm trong Metrics (Azure Monitoring).

Some useful Azure CLI commands

Azure Command-Line Interface (CLI) - Overview | Microsoft Learn

Download logs

Có thể download logs của app service. Cái này hỏi Copilot trực tiếp trong trang Azure Portal.
Vào app service → Monitoring → App Service logs. Có thể thay đổi số ngày lưu trữ và quota lưu trong đây.
Để có thể download/xem logs, download FileZilla về, sau đó vào Deployment Center, FTPS credentials để tìm credentials connect.
Sau khi connect xong, nhấn “…” liên tục để ra root và vào /LogFiles để tìm!

Troubleshooting

◆References◆Bash / SSH to current App Service◆Check quota◆Install custom packages / dependencies into current App Service◆Push local image to ACR◆Health check◆Some useful Azure CLI commands◆Download logs◆Troubleshooting
About|My sketches |Cooking |Cafe icon Support Thi
💌 [email protected]
1az webapp ssh -n MyUniqueAppName -g MyResourceGroup
1# list all local images
2docker images -a
3
4# login
5az login
6
7# create an acr
8az acr create --resource-group web-app-simple-rg --name idetafastapiacr --sku Basic
9
10# login to this acr
11az acr login --name idetafastapiacr
12
13# push local "fastapi-demo" image
14docker login
15# username and password in Container registries -> Settings -> Access keys
16docker tag fastapi-demo idetafastapiacr.azurecr.io/samples/fastapi-demo
17docker push idetafastapiacr.azurecr.io/samples/fastapi-demo
1# List all slots of a given App Service
2az webapp deployment slot list --name <webAppName> --resource-group <resourceGroupName>