Chuyển đến nội dung
Skillpedia
Triển khai và đám mây (DevOps)48k · #3876

azd-deployment

Skill này làm gì

Công cụ này giúp chuẩn bị và kiểm tra việc triển khai các ứng dụng đóng gói trong container lên Azure. Nó dùng các tệp cấu hình để định nghĩa cách ứng dụng của bạn được triển khai và đảm bảo mọi thứ sẵn sàng trước khi thay đổi.

Khi nào nên dùng

  • ✓Khi bạn muốn triển khai ứng dụng frontend và backend lên Azure Container Apps.
  • ✓Khi bạn cần build image của ứng dụng từ xa trên Azure.
  • ✓Khi bạn muốn thiết lập quyền truy cập (managed identity) cho ứng dụng.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/azd-deployment/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/azd-deployment/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tôi muốn triển khai ứng dụng web có backend lên Azure Container Apps, dùng Bicep cho hạ tầng và build image từ xa.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Bạn cấu hình tệp tên azure.yaml để mô tả ứng dụng và cách triển khai. Sau đó, bạn dùng các lệnh như 'azd up' để chuẩn bị và triển khai mọi thứ lên Azure.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Azure Developer CLI (azd) Container Apps Deployment

Deploy containerized frontend + backend applications to Azure Container Apps with remote builds, managed identity, and idempotent infrastructure.

Authorization and preparation

Inspect existing project files and the active tenant, subscription and environment first. Provisioning, deployment, role assignments and hook execution change cloud resources and may incur costs. Prepare the exact diff, target, estimated impact and rollback plan; execute only when the user explicitly authorizes that deployment. Do not print environment values or credentials into shared logs.

Quick Start

# Initialize and deploy
azd auth login
azd init                    # Creates azure.yaml and .azure/ folder
azd env new <env-name>      # Create environment (dev, staging, prod)
azd up                      # Provision infra + build + deploy

Core File Structure

project/
├── azure.yaml              # azd service definitions + hooks
├── infra/
│   ├── main.bicep          # Root infrastructure module
│   ├── main.parameters.json # Parameter injection from env vars
│   └── modules/
│       ├── container-apps-environment.bicep
│       └── container-app.bicep
├── .azure/
│   ├── config.json         # Default environment pointer
│   └── <env-name>/
│       ├── .env            # Environment-specific values (azd-managed)
│       └── config.json     # Environment metadata
└── src/
    ├── frontend/Dockerfile
    └── backend/Dockerfile

azure.yaml Configuration

Minimal Configuration

name: azd-deployment
services:
  backend:
    project: ./src/backend
    language: python
    host: containerapp
    docker:
      path: ./Dockerfile
      remoteBuild: true

Full Configuration with Hooks

name: azd-deployment
metadata:
  template: my-project@1.0.0

infra:
  provider: bicep
  path: ./infra

azure:
  location: eastus2

services:
  frontend:
    project: ./src/frontend
    language: ts
    host: containerapp
    docker:
      path: ./Dockerfile
      context: .
      remoteBuild: true

  backend:
    project: ./src/backend
    language: python
    host: containerapp
    docker:
      path: ./Dockerfile
      context: .
      remoteBuild: true

hooks:
  preprovision:
    shell: sh
    run: |
      echo "Before provisioning..."
      
  postprovision:
    shell: sh
    run: |
      echo "After provisioning - set up RBAC, etc."
      
  postdeploy:
    shell: sh
    run: |
      echo "Frontend: ${SERVICE_FRONTEND_URI}"
      echo "Backend: ${SERVICE_BACKEND_URI}"

Key azure.yaml Options

Option Description
remoteBuild: true Build images in Azure Container Registry (recommended)
context: . Docker build context relative to project path
host: containerapp Deploy to Azure Container Apps
infra.provider: bicep Use Bicep for infrastructure

Environment Variables Flow

Three-Level Configuration

  1. Local .env - For local development only
  2. .azure/<env>/.env - azd-managed, auto-populated from Bicep outputs
  3. main.parameters.json - Maps env vars to Bicep parameters

Parameter Injection Pattern

// infra/main.parameters.json
{
  "parameters": {
    "environmentName": { "value": "${AZURE_ENV_NAME}" },
    "location": { "value": "${AZURE_LOCATION=eastus2}" },
    "azureOpenAiEndpoint": { "value": "${AZURE_OPENAI_ENDPOINT}" }
  }
}

Syntax: ${VAR_NAME} or ${VAR_NAME=default_value}

Setting Environment Variables

# Set for current environment
azd env set AZURE_OPENAI_ENDPOINT "https://my-openai.openai.azure.com"
azd env set AZURE_SEARCH_ENDPOINT "https://my-search.search.windows.net"

# Set during init
azd env new prod
azd env set AZURE_OPENAI_ENDPOINT "..." 

Bicep Output → Environment Variable

// In main.bicep - outputs auto-populate .azure/<env>/.env
output SERVICE_FRONTEND_URI string = frontend.outputs.uri
output SERVICE_BACKEND_URI string = backend.outputs.uri
output BACKEND_PRINCIPAL_ID string = backend.outputs.principalId

Deployment Repeatability

Reconciliation and revision changes

  1. Bicep is declarative - Resources reconcile to desired state
  2. Remote builds tag uniquely - Image tags include deployment timestamp
  3. ACR reuses layers - Only changed layers upload

Preserve unmanaged changes deliberately

…

Câu hỏi thường gặp

“remoteBuild: true” nghĩa là gì?

Nghĩa là image của ứng dụng sẽ được build trực tiếp trên Azure, thay vì trên máy tính cục bộ. Cách này thường nhanh hơn và hiệu quả hơn.

“Hooks” là gì?

Đó là các lệnh bạn thiết lập để chạy trước hoặc sau một số bước triển khai, như trước khi cấp phát hạ tầng hoặc sau khi triển khai ứng dụng.

azd quản lý cấu hình môi trường như thế nào?

azd dùng các tệp như `.env` và `main.parameters.json` để quản lý cấu hình riêng cho từng môi trường (như phát triển, thử nghiệm hoặc sản phẩm thật), đảm bảo dùng đúng thông tin.

Chi tiết

Mô tả gốc của tác giả

Prepare and verify authorized Azure Container Apps deployments with azd. Use for azure.yaml, Bicep, remote builds, managed identity and post-deploy checks.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#3876
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự