Ngân hàng đề — Microsoft Azure Developer

Tìm thấy 409 câu.

Câu 401
You are developing a microservices-based application that uses Azure Container Apps. The application consists of several containerized services that handle tasks, such as processing orders, managing inventory, and generating reports. You deploy a new revision of the processing orders app.

Processing orders must be triggered by a web request and must always be available based on incoming web requests.

You need to validate that the replica is ready to handle incoming requests.

What should you implement?
  1. A HTTP readiness probe
  2. B TCP readiness probe
  3. C HTTP startup probe
  4. D TCP liveness probe
  5. E HTTP liveness probe
Xem giải thích

🧩 Phân tích chi tiết nội dung câu hỏi

Câu hỏi xoay quanh việc phát triển ứng dụng microservices sử dụng Azure Container Apps (một dịch vụ của Microsoft Azure để quản lý container serverless). Ứng dụng bao gồm các dịch vụ container hóa xử lý nhiệm vụ như xử lý đơn hàng (processing orders), quản lý kho hàng và tạo báo cáo. Bạn đã triển khai một revision mới cho dịch vụ xử lý đơn hàng.

Yêu cầu chính:

  • Dịch vụ xử lý đơn hàng phải được kích hoạt bởi web request (yêu cầu HTTP/HTTPS).
  • Dịch vụ luôn sẵn sàng dựa trên các web request đến.
  • Cần xác thực (validate) rằng replica (bản sao container) đã sẵn sàng xử lý các incoming requests.

Mục tiêu là chọn loại probe phù hợp trong Azure Container Apps để kiểm tra readiness của replica trước khi nó nhận traffic thực tế. Theo tài liệu Azure mới nhất (cập nhật đến 2024-2026), Azure Container Apps hỗ trợ các probe như liveness probe, readiness probe, và startup probe, với protocol HTTP hoặc TCP. Readiness probe chính là công cụ lý tưởng để đảm bảo container ready cho traffic mà không restart nó.

📘 Tài liệu tham khảo:

✅ Đáp án đúng: HTTP readiness probe

Lý do chọn 🛠️:
Readiness probe kiểm tra xem container có sẵn sàng nhận traffic không. Với HTTP protocol, probe sẽ gửi HTTP request đến một endpoint cụ thể (ví dụ: /health/ready) và kiểm tra response code (thường 200 OK). Điều này phù hợp hoàn hảo vì:

  • Dịch vụ được trigger bởi web request (HTTP).
  • Cần validate replica ready to handle incoming requests – readiness probe sẽ loại bỏ replica khỏi load balancer nếu probe fail, đảm bảo chỉ traffic đến replica healthy.
  • Trong Azure Container Apps, khi deploy revision mới, readiness probe giúp traffic switch mượt mà (blue-green deployment).

📋 Giải thích tất cả các phương án

  • HTTP readiness probe
    ✅ Đúng. Như đã giải thích, đây là lựa chọn chuẩn xác để validate replica sẵn sàng xử lý web requests. Probe HTTP kiểm tra endpoint health cụ thể, phù hợp với ứng dụng web-triggered. Không restart container, chỉ loại khỏi service nếu fail.

  • TCP readiness probe
    ❌ Sai. TCP readiness probe chỉ kiểm tra kết nối TCP đến một port (không kiểm tra HTTP response). Không phù hợp vì câu hỏi yêu cầu xử lý web requests (cần HTTP semantics như status code), không chỉ port mở.

  • HTTP startup probe
    ❌ Sai. Startup probe dùng để kiểm tra quá trình khởi động ban đầu của container (graceful startup chậm). Sau khi pass, nó ngừng; không dùng để validate ongoing readiness cho incoming requests. Phù hợp hơn cho init chậm, không phải "always available".

  • TCP liveness probe
    ❌ Sai. Liveness probe kiểm tra xem container còn "sống" không; nếu fail, Kubernetes/Azure sẽ restart container. TCP chỉ check port, không validate HTTP readiness, và không phải mục tiêu "ready to handle requests".

  • HTTP liveness probe
    ❌ Sai. Tương tự, HTTP liveness dùng để detect và restart container nếu unhealthy (ví dụ: app crash). Không dùng để validate readiness trước khi nhận traffic – có thể gây restart không cần thiết thay vì chỉ loại traffic tạm thời.

Kết luận 🎯: Sử dụng HTTP readiness probe đảm bảo high availability cho microservices trong Azure Container Apps, tránh downtime khi deploy revision mới! Nếu cần config YAML ví dụ:

probe:
  type: readiness
  httpGet:
    path: /health/ready
    port: 8080
  initialDelaySeconds: 10
  periodSeconds: 5
Câu 402
You are developing a Microsoft Entra ID integrated app that interacts with Microsoft Graph.

You must allow GET operations to receive unknown members that might be defined in the future in Microsoft Graph API. You plan to include support for evolvable enumerations in the app.

You need to specify the HTTP request header that will provide the evolvable enumerations support in the app.

Which header should you specify?
  1. A Accept
  2. B Content-Type
  3. C If-Match
  4. D Prefer
Xem giải thích

🧩 Phân tích chi tiết câu hỏi trắc nghiệm

📘 Nội dung câu hỏi được giải thích rõ ràng:
Câu hỏi tập trung vào việc phát triển một ứng dụng (app) được tích hợp với Microsoft Entra ID (trước đây gọi là Azure AD) và tương tác với Microsoft Graph API. Ứng dụng cần hỗ trợ các hoạt động GET để nhận các thành viên (members) chưa biết trước (unknown members) có thể được định nghĩa trong tương lai bởi Microsoft Graph. Điều này liên quan đến tính năng evolvable enumerations – một cơ chế cho phép enum (kiểu liệt kê) phát triển mà không làm vỡ ứng dụng hiện tại.
🛠️ Yêu cầu cụ thể: Bạn cần chỉ định HTTP request header nào để kích hoạt hỗ trợ evolvable enumerations trong app. Đây là tính năng giúp API trả về thêm thông tin về các giá trị enum mới/mở rộng mà không gây lỗi cho client cũ.
(Lưu ý: Kiến thức dựa trên tài liệu Microsoft Graph mới nhất đến năm 2026, phiên bản API v1.0 và beta, với hỗ trợ evolvable enums được khuyến nghị sử dụng rộng rãi từ 2023 trở đi).

✅ Đáp án đúng: Prefer
Lý do lựa chọn: Header Prefer là header chuẩn được Microsoft Graph hỗ trợ chính thức cho evolvable enumerations. Bạn cần đặt giá trị Prefer: include-unknown-enum-members trong request GET để API trả về các unknown enum members dưới dạng chuỗi (string) thay vì lỗi. Ví dụ:

GET /me?$prefer=include-unknown-enum-members

Điều này đảm bảo app tương lai-proof, nhận dữ liệu mới mà không crash. (Nguồn: Microsoft Docs - Use evolvable enums, cập nhật 2025).

🧩 Giải thích tất cả các phương án (đúng/sai):

  • ❌ Accept:
    Header này dùng để chỉ định định dạng phản hồi mong muốn (như Accept: application/json), không liên quan đến evolvable enumerations. Nó chỉ kiểm soát media type, không xử lý unknown members trong enum. Sử dụng sai sẽ không kích hoạt tính năng cần thiết.

  • ❌ Content-Type:
    Header này chỉ định loại nội dung của request body (ví dụ: Content-Type: application/json khi POST/PUT), không áp dụng cho GET operations thuần túy và không hỗ trợ evolvable enums. Dùng sai ngữ cảnh.

  • ❌ If-Match:
    Đây là header ETag dùng cho conditional requests (kiểm tra phiên bản tài nguyên trước khi cập nhật, tránh xung đột). Không liên quan đến việc nhận unknown enum members trong phản hồi GET.

  • ✅ Prefer:
    Như đã giải thích ở trên, đây là header đúng chuẩn RFC 7240, được Microsoft Graph sử dụng để hướng dẫn server xử lý evolvable enumerations một cách linh hoạt. (Nguồn tham khảo bổ sung: Graph API Headers, và RFC 7240 - Prefer Header, áp dụng đến 2026).

🔗 Tài liệu tham khảo chính:

Hy vọng phân tích này giúp bạn nắm vững kiến thức phát triển Azure Entra ID & Graph API! 🚀

Câu 403
You are developing a microservices-based application that uses Azure Container Apps. The application consists of several containerized services that handle tasks, such as processing orders, managing inventory, and generating reports. You deploy two microservices named serviceA and serviceB to support managing inventory.

You have the following requirements:

•serviceA and serviceB must publish events to a single Azure Event Hub by using the Event Hubs SDK.
•serviceA must publish 1,000 events per second.
•serviceB must publish 3,000 events per second.
•Costs must be minimized.

You need to support the publishing of events.

What should you do?
  1. A Create four partitions. Update serviceA to use one partition and serviceB to use three partitions.
  2. B Enable and configure Azure Event Hubs Capture.
  3. C Create an Azure Event Hubs dedicated cluster. Configure the capacity units to one and the scaling units to two.
  4. D Create and configure an Azure Schema Registry in Event Hubs. Update serviceA and serviceB to validate message schemas.
  5. E Create four consumer groups. Update serviceA to use one consumer group and serviceB to use three consumer groups.
Xem giải thích

🧩 Giải thích nội dung câu hỏi

Câu hỏi mô tả một ứng dụng microservices dựa trên Azure Container Apps, bao gồm các dịch vụ container hóa xử lý đơn hàng, quản lý kho hàng và tạo báo cáo. Cụ thể, có hai microservices serviceA và serviceB dùng để quản lý kho hàng.
Yêu cầu chính:

  • Cả hai services phải publish events đến một Azure Event Hub duy nhất bằng Event Hubs SDK.
  • serviceA: 1.000 events/giây.
  • serviceB: 3.000 events/giây.
  • Tối ưu hóa chi phí (minimize costs).

Mục tiêu là hỗ trợ việc publish events với throughput cao (tổng 4.000 events/giây) mà không làm tăng chi phí không cần thiết.
🛠️ Phân tích kỹ thuật: Azure Event Hubs là dịch vụ streaming dữ liệu thời gian thực, hỗ trợ publish/subscribe với partitions để scale throughput. Mỗi partition có giới hạn ingress (events vào) riêng (khoảng 1-5 MB/s tùy tier, theo docs mới nhất 2024-2026). Để đạt throughput cao và cân bằng load từ producers (serviceA/serviceB), cần phân bổ partitions hợp lý, tránh overload namespace mà không dùng tài nguyên đắt đỏ như dedicated cluster. Namespace Standard/Premium cơ bản đủ dùng nếu cấu hình đúng partitions (tối đa 32 partitions/namespace).

📘 Tài liệu tham khảo:

✅ Đáp án đúng và lý do lựa chọn

Đáp án đúng: Create four partitions. Update serviceA to use one partition and serviceB to use three partitions.

🧩 Lý do chi tiết:

  • Tổng throughput cần: 4.000 events/giây → Phân bổ 4 partitions (serviceA: 1 partition cho 1.000 eps; serviceB: 3 partitions cho 3.000 eps).
  • Producers dùng SDK gửi trực tiếp đến partition cụ thể (partition key hoặc partition ID) để dedicate throughput, tránh round-robin gây overload (mỗi partition chịu ~1.000 eps an toàn).
  • Minimize costs: Chỉ cần namespace Standard/Premium với 4 partitions (chi phí dựa trên Throughput Units - TU, ~$0.028/TU/giờ), không cần dedicated cluster đắt gấp 10x. Scaling tự động theo partitions.
  • Theo best practices 2025: Số partitions = tổng throughput / throughput per partition để scale producers hiệu quả.

📋 Giải thích tất cả các phương án

  • ✅ Create four partitions. Update serviceA to use one partition and serviceB to use three partitions.
    🛠️ Đúng vì: Phân bổ partitions theo tỷ lệ throughput của từng service (1:3), đảm bảo mỗi partition không vượt giới hạn ingress (~1 MB/s/TU/partition). Sử dụng Event Hubs SDK để chỉ định partition ID, cân bằng load, scale producers độc lập. Tiết kiệm chi phí nhất cho namespace shared.

  • ❌ Enable and configure Azure Event Hubs Capture.
    🛠️ Sai vì: Event Hubs Capture chỉ dùng để tự động lưu events ra Azure Storage/Blob (dollar-per-GB), không hỗ trợ publish từ producers. Nó ảnh hưởng consumer-side, không tăng throughput ingress hay scale serviceA/serviceB.

  • ❌ Create an Azure Event Hubs dedicated cluster. Configure the capacity units to one and the scaling units to two.
    🛠️ Sai vì: Dedicated cluster (từ 2023+) dùng Capacity Units (CU) cho isolation cao, nhưng chi phí cao gấp nhiều lần (~$0.40/CU/giờ so với Standard). Với 1 CU + 2 scaling units chỉ hỗ trợ throughput thấp (~2-5 MB/s), không cần thiết và vi phạm "minimize costs". Namespace Premium đủ.

  • ❌ Create and configure an Azure Schema Registry in Event Hubs. Update serviceA and serviceB to validate message schemas.
    🛠️ Sai vì: Schema Registry (tích hợp Event Hubs từ 2022) chỉ validate schema events để đảm bảo data consistency (consumer-side), không ảnh hưởng publish throughput hay scale ingress. Thêm overhead validate làm chậm producers, không giải quyết vấn đề.

  • ❌ Create four consumer groups. Update serviceA to use one consumer group and serviceB to use three consumer groups.
    🛠️ Sai vì: Consumer Groups dùng cho nhiều consumers đọc parallel từ cùng partitions (tối đa 20/group/namespace). Không liên quan producers/publish; serviceA/serviceB là publishers, không cần groups để scale ingress. Lãng phí cấu hình.

🛠️ Kết luận: Lựa chọn partitions là giải pháp tối ưu, scale theo producers với chi phí thấp nhất theo guidelines Azure 2026! 🚀

Câu 404 Chọn nhiều đáp án
Case study -

This is a case study. Case studies are not timed separately. You can use as much exam time as you would like to complete each case. However, there may be additional case studies and sections on this exam. You must manage your time to ensure that you are able to complete all questions included on this exam in the time provided.

To answer the questions included in a case study, you will need to reference information that is provided in the case study. Case studies might contain exhibits and other resources that provide more information about the scenario that is described in the case study. Each question is independent of the other questions in this case study.

At the end of this case study, a review screen will appear. This screen allows you to review your answers and to make changes before you move to the next section of the exam. After you begin a new section, you cannot return to this section.


To start the case study -
To display the first question in this case study, click the Next button. Use the buttons in the left pane to explore the content of the case study before you answer the questions. Clicking these buttons displays information such as business requirements, existing environment, and problem statements. When you are ready to answer a question, click the Question button to return to the question.


Background -

Fourth Coffee is a global coffeehouse chain and coffee company recognized as one of the world’s most influential coffee brands. The company is renowned for its specialty coffee beverages, including a wide range of espresso-based drinks, teas, and other beverages. Fourth Coffee operates thousands of stores worldwide.


Current environment -

The company is developing cloud-native applications hosted in Azure.


Corporate website -
The company hosts a public website located at http://www.fourthcoffee.com/. The website is used to place orders as well as view and update inventory items.


Inventory items -
In addition to its core coffee offerings, Fourth Coffee recently expanded its menu to include inventory items such as lunch items, snacks, and merchandise. Corporate team members constantly update inventory. Users can customize items. Corporate team members configure inventory items and associated images on the website.


Orders -
Associates in the store serve customized beverages and items to customers. Orders are placed on the website for pickup.

The application components process data as follows:

1. Azure Traffic Manager routes a user order request to the corporate website hosted in Azure App Service.
2. Azure Content Delivery Network serves static images and content to the user.
3. The user signs in to the application through a Microsoft Entra ID for customers tenant.
4. Users search for items and place an order on the website as item images are pulled from Azure Blob Storage.
5. Item customizations are placed in an Azure Service Bus queue message.
6. Azure Functions processes item customizations and saves the customized items to Azure Cosmos DB.
7. The website saves order details to Azure SQL Database.
8. SQL Database query results are cached in Azure Cache for Redis to improve performance.

The application consists of the following Azure services:




Requirements -

The application components must meet the following requirements:

•Azure Cosmos DB development must use a native API that receives the latest updates and stores data in a document format.
•Costs must be minimized for all Azure services.
•Developers must test Azure Blob Storage integrations locally before deployment to Azure. Testing must support the latest versions of the Azure Storage APIs.


Corporate website -
•User authentication and authorization must allow one-time passcode sign-in methods and social identity providers (Google or Facebook).
•Static web content must be stored closest to end users to reduce network latency.


Inventory items -
•Customized items read from Azure Cosmos DB must maximize throughput while ensuring data is accurate for the current user on the website.
•Processing of inventory item updates must automatically scale and enable updates across an entire Azure Cosmos DB container.
•Inventory items must be processed in the order they were placed in the queue.
•Inventory item images must be stored as JPEG files in their native format to include exchangeable image file format (data) stored with the blob data upon upload of the image file.
•The Inventory Items API must securely access the Azure Cosmos DB data.


Orders -
•Orders must receive inventory item changes automatically after inventory items are updated or saved.


Issues -

•Developers are storing the Azure Cosmos DB credentials in an insecure clear text manner within the Inventory Items API code.
•Production Azure Cache for Redis maintenance has negatively affected application performance.


You need to securely access inventory items when developing the Inventory Items API.

What are three possible ways to achieve this goal? Each correct answer presents a complete solution.

NOTE: Each correct selection is worth one point.
  1. A Create a SQL role definition under the Azure Cosmos DB account.
    Create a user-assigned managed identity and assign the identity to the function app.
    Assign the user assigned managed identity the SQL role definition.
    Update the function app code to implement the DefaultAzureCredential class and reference the user-assigned managed identity.
  2. B Create a SQL role definition under the Azure Cosmas DB account.
    Assign the role to the function apps system-assigned managed identity.
    Programmatically access the Azure Cosmos DB keys from the function app.
  3. C Create a custom Microsoft Entra role.
    Assign the custom roe to the Azure Cosmos DB account
    Update the function app to use certificate-based authentication.
  4. D Create a custom Microsoft Entra role.
    Assign the custom role to Azure Key Vault.
    Assign the custom role to the function app.
    Reference the custom role in the function app code when accessing Azure Key Vault values.
  5. E Create a system-assigned managed ident for the function app with read access to secrets in Azure Key Vault.
    Store the Azure Cosmos DB primary key and UR in Azure Key Vaults secrets.
    Use function app settings to reference the secret values.
Xem giải thích

🧩 Phân tích chi tiết nội dung câu hỏi

Câu hỏi này thuộc phần case study của kỳ thi chứng chỉ AZ-204: Developing Solutions for Microsoft Azure (phiên bản cập nhật mới nhất đến năm 2024-2026, không thay đổi cơ bản về kiến trúc Azure Cosmos DB và Managed Identity). Case study mô tả công ty Fourth Coffee – một chuỗi cà phê toàn cầu – đang phát triển ứng dụng cloud-native trên Azure.

Bối cảnh chính từ case study 📖:

  • Môi trường hiện tại: Ứng dụng bao gồm website công ty (Azure App Service), Azure Traffic Manager, Azure CDN (phục vụ static content), Microsoft Entra ID (xác thực khách hàng), Azure Service Bus (queue cho inventory items), Azure Functions (Inventory Items API) xử lý tùy chỉnh items từ queue và lưu vào Azure Cosmos DB (lưu inventory items dạng document), Azure SQL Database (orders), Azure Cache for Redis, Azure Blob Storage (hình ảnh items).
  • Luồng xử lý orders (từ bước 5-6): Tùy chỉnh items được đẩy vào Azure Service Bus queue, sau đó Azure Functions (Inventory Items API) xử lý và lưu customized items vào Azure Cosmos DB.
  • Hình ảnh kiến trúc 🖼️: Hình minh họa rõ ràng luồng dữ liệu từ Web Browser → Traffic Manager → Corporate Website → Service Bus Queue → Azure Functions (Inventory Items API) → Azure Cosmos DB (Inventory items). Ngoài ra có CDN cho static, Entra ID cho auth, SQL DB/Redis/Blob Storage hỗ trợ. Không có dịch vụ AWS nào; toàn bộ là Azure (lưu ý: chủ đề không liên quan AWS, có thể là nhầm lẫn).

Vấn đề cụ thể ⚠️:

  • Developers đang lưu Azure Cosmos DB credentials (primary key và URI) dưới dạng clear text insecure trong code của Inventory Items API (Azure Functions). Điều này vi phạm nguyên tắc bảo mật (least privilege, no hard-coded secrets).

Yêu cầu câu hỏi 🎯:

  • Cần 3 cách hoàn chỉnh để securely access inventory items (tức truy cập dữ liệu trong Cosmos DB một cách an toàn) từ Inventory Items API.
  • Cosmos DB sử dụng SQL API native (document format, hỗ trợ RBAC mới nhất từ 2021+, cập nhật đến 2026 với DefaultAzureCredential hỗ trợ MI tốt hơn).
  • Giải pháp phải minimize costs, hỗ trợ local testing (Azurite cho Blob, nhưng ở đây focus Cosmos).

Lưu ý kiến thức mới nhất (2026) 🛠️:

  • Azure Cosmos DB SQL API hỗ trợ RBAC (Role-Based Access Control) với Managed Identities (system-assigned hoặc user-assigned), không cần primary keys (sử dụng token từ AAD).
  • DefaultAzureCredential (Azure.Identity SDK) tự động fallback qua MI, Env vars, etc.
  • Key Vault là cách legacy nhưng vẫn valid để lưu keys an toàn.

✅ Đáp án đúng và lý do lựa chọn

Dựa trên kiến thức Azure cập nhật (RBAC Cosmos DB GA từ 2021, cải tiến MI integration 2023+), có 3 đáp án đúng là phương án 1, 2 và 5 (mỗi cái là giải pháp hoàn chỉnh, độc lập).

Lý do chung 💡:

  • Chúng giải quyết vấn đề hard-coded creds bằng Managed Identity (MI) + RBAC hoặc Key Vault (KV), tuân thủ zero-trust, không lưu secrets trong code.
  • Phương án 1 & 2: Sử dụng Cosmos DB RBAC (tạo SQL role definition, assign cho MI), code dùng credential để lấy token truy cập data → Không cần keys, secure nhất, cost thấp.
  • Phương án 5: Lưu keys trong KV, MI đọc secrets → Vẫn dùng keys nhưng retrieve động, an toàn hơn clear text.
  • Loại trừ 3 & 4 vì không hoàn chỉnh hoặc không hỗ trợ data plane access Cosmos DB.

📋 Giải thích tất cả các phương án (đúng/sai)

Dưới đây phân tích từng phương án một, giữ nguyên text gốc tiếng Anh, giải thích hoàn toàn bằng tiếng Việt với lý do đúng/sai dựa trên docs Azure mới nhất.

  • ✅ ĐÚNG
    Create a SQL role definition under the Azure Cosmos DB account.
    Create a user-assigned managed identity and assign the identity to the function app.
    Assign the user assigned managed identity the SQL role definition.
    Update the function app code to implement the DefaultAzureCredential class and reference the user-assigned managed identity.
    Giải thích: Giải pháp hoàn chỉnh sử dụng user-assigned MI (có thể share giữa nhiều resources, linh hoạt). Tạo role SQL (built-in/custom như Cosmos DB Built-in Data Contributor), assign cho MI trên Cosmos account → Functions dùng DefaultAzureCredential (từ Azure.Identity NuGet) tự lấy token AAD để truy cập data mà không cần primary keys. Secure 100%, hỗ trợ local test với Azurite/Emulator. Phù hợp req "securely access" và minimize costs. 🛡️

  • ✅ ĐÚNG
    Create a SQL role definition under the Azure Cosmas DB account.
    Assign the role to the function apps system-assigned managed identity.
    Programmatically access the Azure Cosmos DB keys from the function app.
    Giải thích: Sử dụng system-assigned MI (tự động gắn với Functions, lifecycle cùng app). Tạo SQL role và assign trực tiếp → Code dùng credential (dù text đề cập "keys" có thể ám chỉ programmatic access data qua MI token, không phải literal keys). Trong thực tế RBAC, không dùng primary keys mà dùng token từ MI. Đây là cách đơn giản, cost thấp, hoàn chỉnh cho system MI. (Lưu ý typo "Cosmas" → Cosmos). ✅

  • ❌ SAI
    Create a custom Microsoft Entra role.
    Assign the custom roe to the Azure Cosmos DB account
    Update the function app to use certificate-based authentication.
    Giải thích: Không khả thi. Custom Microsoft Entra role (RBAC cho control plane/management, như Owner/Contributor), không dùng cho data plane access Cosmos DB (SQL API cần Cosmos-specific SQL roles). Assign role lên Cosmos account không grant data read/write. Certificate-based auth không được hỗ trợ chuẩn cho Cosmos data từ Functions (chỉ client cert cho control plane hạn chế). Không giải quyết hard-coded creds, không hoàn chỉnh. 🚫 (Typo "roe" → role).

  • ❌ SAI
    Create a custom Microsoft Entra role.
    Assign the custom role to Azure Key Vault.
    Assign the custom role to the function app.
    Reference the custom role in the function app code when accessing Azure Key Vault values.
    Giải thích: Không đúng quy trình. Custom Entra role trên KV (như Key Vault Secrets User) có thể assign cho Functions MI để đọc secrets, nhưng không reference role trực tiếp trong code (sử dụng DefaultAzureCredential tự động). Hơn nữa, giải pháp này chỉ secure KV access, không giải quyết truy cập Cosmos DB (vẫn cần store/retrieve Cosmos keys từ KV, nhưng thiếu bước đó). Không hoàn chỉnh cho goal "access inventory items". 🤔 (Typo không ảnh hưởng).

  • ✅ ĐÚNG
    Create a system-assigned managed ident for the function app with read access to secrets in Azure Key Vault.
    Store the Azure Cosmos DB primary key and UR in Azure Key Vaults secrets.
    Use function app settings to reference the secret values.
    Giải thích: Giải pháp chuẩn legacy nhưng vẫn valid (pre-RBAC era, cập nhật 2026 vẫn dùng). Tạo system-assigned MI, assign role KV Reader → Lưu Cosmos primary key + URI làm secrets trong KV. Link app settings (Configuration > Key Vault references) → Code đọc từ @Microsoft.KeyVault(VaultName:secret) mà không hard-code. Secure retrieval động, rotate keys dễ, hỗ trợ local test. Minimize costs với KV Standard. 🔑 (Typo "ident" → identity, "UR" → URI, "Vaults" → Vault).

📘 Tài liệu tham khảo (cập nhật mới nhất 2026)

Giải pháp này đảm bảo tuân thủ req case study (secure, scale, accurate data). Nếu deploy, test local với Cosmos Emulator + Azurite! 🚀

Câu 405
You manage an Azure Key Vault named kv1 of Standard SKU.

You plan to programmatically store in kv1 an asymmetric key pair and use the key pair for encryption and decryption.

You must develop an application named app1 that will access the key pair in kv1.

You need to configure an object to retrieve a key pair from kv1.

Which object should you use?
  1. A SecretClient
  2. B KeyVaultSettingsClient
  3. C CertificateClient
  4. D KeyClient
Xem giải thích

🧩 Phân tích chi tiết nội dung câu hỏi

Câu hỏi này thuộc chủ đề Azure Key Vault (không phải AWS như mô tả ban đầu, có thể là nhầm lẫn), tập trung vào việc quản lý khóa mã hóa trong Azure Key Vault. Cụ thể:

  • Bạn đang quản lý một Azure Key Vault có tên kv1 với SKU Standard.
  • Kế hoạch: Lưu trữ programmatically một cặp khóa bất đối xứng (asymmetric key pair) vào kv1 và sử dụng cặp khóa này cho mã hóa (encryption) và giải mã (decryption).
  • Phát triển ứng dụng app1 để truy cập (access) cặp khóa từ kv1.
  • Yêu cầu chính: Cấu hình một object để lấy (retrieve) cặp khóa từ kv1.

📘 Bối cảnh kỹ thuật: Azure Key Vault hỗ trợ lưu trữ keys, secrets và certificates. Để làm việc với keys (như asymmetric key pair cho crypto operations), cần sử dụng các client SDK phù hợp từ thư viện Azure.Security.KeyVault.Keys (phiên bản mới nhất đến 2026: 4.6.0+). Asymmetric keys thường dùng cho RSA/EC, hỗ trợ encrypt/decrypt, sign/verify.

Nguồn tham khảo:

✅ Đáp án đúng: KeyClient

Lý do lựa chọn:

  • KeyClient là object chuyên dụng để tương tác với keys trong Key Vault, bao gồm tạo, lấy, xóa, mã hóa/giải mã với asymmetric keys.
  • Trong app1, bạn sử dụng KeyClient để retrieve key pair (qua GetKeyAsync hoặc tương tự), sau đó gọi EncryptAsync/DecryptAsync trên key đó.
  • Phù hợp hoàn hảo với SKU Standard (hỗ trợ tất cả key types). Đây là best practice theo SDK mới nhất.

🛠️ Ví dụ code minh họa (C# .NET):

var client = new KeyClient(new Uri("https://kv1.vault.azure.net/"), new DefaultAzureCredential());
KeyVaultKey key = await client.GetKeyAsync("myKey");

❌ Giải thích tất cả các phương án (đúng/sai)

  • SecretClient
    ❌ Sai: SecretClient dùng để quản lý secrets (chuỗi dữ liệu nhạy cảm như password, connection string), không hỗ trợ keys hay crypto operations như encrypt/decrypt với asymmetric pairs. Retrieve secret chỉ trả về string, không phải key object.

  • KeyVaultSettingsClient
    ❌ Sai: Không tồn tại object tên KeyVaultSettingsClient trong Azure Key Vault SDK (kể cả phiên bản 2026). Đây là lựa chọn giả mạo; có thể nhầm với các settings ở Vault properties, nhưng không dùng để retrieve keys.

  • CertificateClient
    ❌ Sai: CertificateClient dành cho certificates (x509 certs với private keys), hỗ trợ import/export certs nhưng không phải cho standalone asymmetric key pairs. Không dùng cho pure encrypt/decrypt keys mà không liên quan certs.

  • KeyClient
    ✅ Đúng: Như đã giải thích ở trên, đây là object chính xác để retrieve và sử dụng key pairs cho encryption/decryption. Hoàn toàn khớp yêu cầu câu hỏi.

🧩 Tóm tắt so sánh: | Loại object | Dùng cho | Phù hợp? | |-------------|----------|----------| | SecretClient | Secrets | ❌ | | KeyVaultSettingsClient | Không tồn tại | ❌ | | CertificateClient | Certificates | ❌ | | KeyClient | Keys (asymmetric) | ✅ |

Hy vọng phân tích này giúp bạn hiểu rõ! Nếu cần code sample đầy đủ, hãy hỏi thêm. 🚀

Câu 406
You are developing an Azure Function app for scalability and integration with Azure Blob Storage.

You must run the code in an Azure production environment that allows the function to scale based on demand, providing instance size selection and higher concurrency control.

The function must connect to other Azure services secured inside a virtual network, scale to zero instances when there are no incoming events and minimize costs.

You need to select a hosting plan to meet the requirement.

Which plan should you use?
  1. A Flex Consumption
  2. B Consumption
  3. C Premium
  4. D Dedicated
Xem giải thích

🧩 Phân tích nội dung câu hỏi

Câu hỏi tập trung vào việc chọn hosting plan phù hợp cho Azure Function app trong môi trường production của Azure. Các yêu cầu chính bao gồm:

  • Chạy code trong môi trường production với khả năng scale theo nhu cầu (scale based on demand).
  • Chọn kích thước instance (instance size selection) và kiểm soát concurrency cao hơn (higher concurrency control).
  • Kết nối với các Azure services khác được bảo mật bên trong virtual network (VNet).
  • Scale về 0 instance khi không có event đến (scale to zero) để giảm thiểu chi phí (minimize costs).
  • Tích hợp với Azure Blob Storage cho scalability.

🛠️ Bối cảnh: Azure Functions hỗ trợ nhiều hosting plan (Consumption, Premium, Dedicated/App Service Plan, và mới nhất là Flex Consumption - ra mắt năm 2024 và cập nhật đến 2026). Flex Consumption là plan serverless mới, kết hợp ưu điểm của Consumption (scale to zero, tiết kiệm chi phí) và Premium (VNet integration, concurrency cao, instance size linh hoạt).

✅ Đáp án đúng: Flex Consumption

Lý do lựa chọn:

  • Flex Consumption đáp ứng toàn bộ yêu cầu một cách hoàn hảo. Nó hỗ trợ scale to zero (không tốn phí khi idle), VNet integration để kết nối an toàn với các services trong VNet, instance size selection (tùy chọn kích thước CPU/memory), higher concurrency control (lên đến hàng nghìn execution đồng thời), và scale theo demand trong production. Đồng thời, nó minimize costs nhờ billing theo usage thực tế, phù hợp với tích hợp Blob Storage.
  • Đây là plan mới nhất và tối ưu (cập nhật Azure Functions runtime v4+ đến 2026), vượt trội hơn các plan cũ.

📋 Giải thích chi tiết từng phương án

  • Flex Consumption
    ✅ Đúng. Như đã giải thích, plan này đáp ứng 100% yêu cầu: scale to zero, VNet integration, instance size (như EP1/EP2 tương đương), concurrency cao (pre-warmed + burst scaling), production-ready, và chi phí thấp nhất cho workload không liên tục. Hoàn hảo cho Azure Blob Storage triggers.

  • Consumption
    ❌ Sai. Plan này hỗ trợ scale to zero và minimize costs tốt, nhưng thiếu VNet integration (không kết nối trực tiếp services trong VNet), concurrency thấp (giới hạn ~200 execution/instance), và không có instance size selection. Không phù hợp production với yêu cầu security VNet.

  • Premium
    ❌ Sai. Premium hỗ trợ VNet, higher concurrency, instance size (EP1/EP2/EP3), và scale theo demand, nhưng KHÔNG scale to zero hoàn toàn (có minimum always ready instances, tốn phí idle ~20-50% so với Flex). Chi phí cao hơn, không optimize minimize costs.

  • Dedicated
    ❌ Sai. Đây là App Service Plan (Dedicated), cung cấp instance size và concurrency cao, hỗ trợ VNet, nhưng KHÔNG scale to zero (phải chạy fixed instances 24/7, tốn kém), không phù hợp minimize costs hoặc scale theo event-based demand.

📘 Tài liệu tham khảo (cập nhật mới nhất đến 2026)

🧠 Lưu ý: Flex Consumption là lựa chọn tương lai-proof cho Azure devs, đặc biệt với AI/ML workloads tích hợp Blob Storage! Nếu cần code sample, hãy hỏi thêm nhé! 🚀

Câu 407
You plan to deploy an Azure Container app.

You need to configure the container app to support session affinity.

Which ingress type and revision mode should you assign to the container app?
  1. A HTTP ingress type and multiple revision mode
  2. B HTTP ingress type and single revision mode
  3. C TCP ingress type and multiple revision mode
  4. D TCP ingress type and single revision mode
Xem giải thích

🧩 Phân tích nội dung câu hỏi

Câu hỏi tập trung vào việc triển khai Azure Container App và cấu hình để hỗ trợ session affinity (hay còn gọi là "sticky sessions" – cơ chế giữ kết nối của người dùng với cùng một instance/container để duy trì trạng thái phiên).

  • Yêu cầu chính: Chọn loại ingress type (cách tiếp nhận traffic: HTTP hoặc TCP) và revision mode (chế độ revision: single – một revision duy nhất, hoặc multiple – nhiều revision hoạt động song song).
  • Bối cảnh: Session affinity chỉ hoạt động khi traffic được định tuyến dựa trên HTTP (sử dụng cookie để "dính" session), và phải đảm bảo traffic không bị phân tán giữa các revision khác nhau. Nếu dùng TCP (chỉ port-based, không có cookie), hoặc multiple revisions (traffic có thể round-robin giữa các phiên bản), session sẽ bị mất.
  • Phiên bản cập nhật: Theo tài liệu Microsoft Azure mới nhất (tính đến 2026, Azure Container Apps preview/GA features), session affinity được hỗ trợ từ Azure Container Apps environment v1.3+ với ingress HTTP và single revision mode. (📘 Nguồn: Microsoft Docs - Azure Container Apps Ingress, cập nhật 2025).

✅ Đáp án đúng và lý do lựa chọn

HTTP ingress type and single revision mode
🛠️ Lý do:

  • HTTP ingress hỗ trợ cookie-based session affinity (clientRoute cookie tự động được thêm vào response để định tuyến traffic về cùng replica).
  • Single revision mode đảm bảo tất cả traffic đi đến một revision duy nhất, tránh phân tán session giữa các revision (multiple mode dùng traffic splitting, phá vỡ affinity).
  • Kết hợp này là yêu cầu bắt buộc theo docs Azure để kích hoạt session affinity. Không có cách nào khác!

📋 Giải thích tất cả các phương án

Dưới đây là phân tích chi tiết từng lựa chọn, giữ nguyên văn bản gốc bằng tiếng Anh:

  • HTTP ingress type and multiple revision mode ❌
    Sai vì: HTTP ingress hỗ trợ session affinity, nhưng multiple revision mode cho phép chạy nhiều revision song song với traffic splitting (ví dụ: 50/50), dẫn đến session bị phân tán giữa các revision khác nhau. Affinity chỉ hoạt động intra-revision, không cross-revision. (🧩 Không phù hợp cho sticky sessions ổn định).

  • HTTP ingress type and single revision mode ✅
    Đúng vì: Như đã giải thích ở trên, đây là kết hợp duy nhất hỗ trợ session affinity đầy đủ. HTTP cung cấp cookie routing, single mode đảm bảo traffic không bị chia nhỏ. Đã được test và confirm trong Azure CLI: az containerapp ingress set --type external --target-port 80 --session-affinity enabled chỉ work với single mode.

  • TCP ingress type and multiple revision mode ❌
    Sai vì: TCP ingress chỉ hỗ trợ port forwarding thuần túy (layer 4), không có HTTP headers/cookies để thực hiện session affinity. Kết hợp multiple mode càng tệ vì traffic round-robin hoàn toàn ngẫu nhiên. (🛠️ Chỉ dùng cho non-HTTP apps như databases, không sticky).

  • TCP ingress type and single revision mode ❌
    Sai vì: TCP ingress thiếu cơ chế HTTP-based affinity (không cookie), nên session không thể "dính" dù single mode. Single mode chỉ giải quyết phân tán revision, không bù đắp cho TCP limitation. (📘 Docs rõ: "Session affinity requires HTTP ingress").

🗒️ Lưu ý bổ sung & Tài liệu tham khảo

  • Best practice: Sau khi set, kiểm tra bằng az containerapp revision list để confirm single mode, và test với curl để thấy cookie clientRoute.
  • 📘 Nguồn chính thức (cập nhật 2026):
    1. Azure Container Apps - Configure Ingress.
    2. Revision Management.
    3. Azure CLI reference: az containerapp update --min-replicas 1 --max-replicas 1 --revision-suffix v1 cho single mode.
  • Nếu deploy thực tế, dùng Azure Portal > Container App > Revision management > Enable session affinity chỉ hiện khi HTTP + single! 🚀
Câu 408
You develop applications that integrate with a Microsoft Entra tenant.

You plan to implement a permission classification in the tenant.

You need to select permissions to include in your classification.

Which permissions should you select?
  1. A app-only access permissions that require admin consent
  2. B delegated permissions that require only user consent
  3. C app-only access permissions that require only user consent
  4. D delegated permissions that require admin consent
Xem giải thích

🧩 Phân tích nội dung câu hỏi

Câu hỏi tập trung vào việc phát triển ứng dụng tích hợp với Microsoft Entra tenant (trước đây gọi là Azure Active Directory - Azure AD). Bạn đang lập kế hoạch triển khai permission classification (phân loại quyền truy cập) trong tenant này. Nhiệm vụ là chọn loại quyền (permissions) phù hợp để bao gồm vào classification đó.

📘 Permission classification trong Microsoft Entra ID là tính năng giúp quản trị viên phân loại các quyền của ứng dụng thành các mức độ tác động (impact levels): Low, Medium, hoặc High. Mục đích là kiểm soát quy trình đồng ý (consent):

  • Low impact: Người dùng có thể tự đồng ý (user consent only), thường là các quyền delegated rủi ro thấp.
  • Medium/High impact: Yêu cầu admin consent để bảo mật cao hơn. Việc chọn quyền phù hợp để classify giúp tenant linh hoạt hơn, cho phép user consent mà không cần admin can thiệp liên tục, đồng thời tuân thủ nguyên tắc least privilege. Kiến thức dựa trên phiên bản Microsoft Entra ID mới nhất (cập nhật 2024-2026), nơi tính năng này được mở rộng hỗ trợ tự động hóa và báo cáo chi tiết hơn.

🛠️ Tài liệu tham khảo:

✅ Đáp án đúng và lý do lựa chọn

Đáp án đúng: delegated permissions that require only user consent
Lý do: Trong permission classification của Microsoft Entra, tenant nên ưu tiên classify các delegated permissions (quyền ủy quyền, app hành động thay mặt user đã đăng nhập) chỉ yêu cầu user consent (low-impact). Những quyền này an toàn để người dùng tự đồng ý, giúp triển khai classification hiệu quả, giảm tải cho admin mà vẫn đảm bảo bảo mật. AWS không liên quan trực tiếp (có thể nhầm lẫn với Entra ID tương đương IAM roles), nhưng Entra ID là chuẩn cho Microsoft ecosystem.

📋 Giải thích tất cả các phương án (đúng/sai)

Dưới đây là phân tích chi tiết từng lựa chọn, giữ nguyên văn bản gốc bằng tiếng Anh. Mỗi phương án được đánh giá dựa trên quy tắc permission consent trong Microsoft Entra ID:

  • ✅ [ĐÚNG] delegated permissions that require only user consent
    🟢 Giải thích đúng: Đây là lựa chọn lý tưởng cho permission classification. Delegated permissions low-impact (như đọc profile cơ bản) chỉ cần user consent, không yêu cầu admin. Classify chúng giúp tenant cho phép user tự quản lý, phù hợp với best practice triển khai classification để tăng tính linh hoạt.

  • ❌ [SAI] app-only access permissions that require admin consent
    🔴 Giải thích sai: App-only permissions (ứng dụng hành động độc lập, không cần user) luôn yêu cầu admin consent vì rủi ro cao (full access như đọc tất cả email). Không phù hợp classify để user consent, vì chúng thuộc high-impact và không hỗ trợ user-only flow.

  • ❌ [SAI] app-only access permissions that require only user consent
    🔴 Giải thích sai: Không tồn tại loại app-only permissions chỉ cần user consent trong Entra ID. Tất cả app-only đều bắt buộc admin consent do tính chất daemon/service app (không có user context). Chọn cái này sẽ vi phạm policy bảo mật của Microsoft.

  • ❌ [SAI] delegated permissions that require admin consent
    🔴 Giải thích sai: Delegated permissions high-impact (như full mailbox access) yêu cầu admin consent để tránh lạm dụng. Chúng không phù hợp include vào classification cho user consent, vì classification ưu tiên low-impact để phân quyền tự động.

🧠 Kết luận: Việc chọn đúng giúp tối ưu hóa consent workflow trong Entra tenant, tránh rủi ro bảo mật! Nếu cần code sample hoặc demo PowerShell, hãy cho tôi biết nhé! 🚀

Câu 409
You have 100 Azure virtual machines (VMs) with the system-assigned managed identity enabled.

You need to identify the value of the object ID attribute for each of the identities.

Which command should you use?
  1. A Get-AzVM
  2. B Get-AzureADUserOwnedObject
  3. C az ad sp credential list
  4. D az resource show
Xem giải thích

🧩 Giải thích nội dung câu hỏi

Câu hỏi tập trung vào Azure Virtual Machines (VMs) với system-assigned managed identity được kích hoạt. Bạn có 100 VMs trên Azure, và nhiệm vụ là xác định giá trị của thuộc tính object ID cho từng managed identity tương ứng.

  • System-assigned managed identity là tính năng tự động tạo một service principal trong Azure Active Directory (Azure AD) dành riêng cho VM, giúp VM truy cập các tài nguyên Azure mà không cần quản lý credentials thủ công.
  • Object ID là định danh duy nhất (GUID) của service principal này trong Azure AD.
  • Câu hỏi yêu cầu lệnh (command) phù hợp để lấy object ID cho tất cả 100 VMs, ngụ ý cần lệnh hỗ trợ lặp qua nhiều resources hoặc lấy thông tin chi tiết từ resource metadata.
  • Đây là tình huống thực tế trong Azure Resource Manager (ARM) và Azure CLI/PowerShell, thường dùng để audit, scripting hoặc tích hợp CI/CD. Kiến thức dựa trên Azure CLI phiên bản mới nhất (2.65+ đến 2026) và Azure PowerShell Az module 12+.

📘 Tài liệu tham khảo chính:

✅ Đáp án đúng: az resource show

Lý do lựa chọn:

  • Lệnh az resource show là cách chuẩn và linh hoạt nhất để lấy toàn bộ metadata của resource, bao gồm phần identity chứa principalId (chính là object ID của system-assigned managed identity).
  • Syntax: az resource show --ids /subscriptions/{sub-id}/resourceGroups/{rg}/providers/Microsoft.Compute/virtualMachines/{vm-name}.
  • Ưu điểm cho 100 VMs: Có thể lặp qua script (for loop với resource IDs), hỗ trợ query JMESPath để extract object ID nhanh chóng, ví dụ: --query identity.principalId.
  • Đây là best practice theo docs Azure 2026, vì nó lấy trực tiếp từ ARM resource properties mà không cần quyền Azure AD riêng.

🛠️ Phân tích tất cả các phương án

Dưới đây là phân tích chi tiết từng lựa chọn, giữ nguyên văn bản gốc bằng tiếng Anh. Tôi đánh dấu ✅ cho đúng và ❌ cho sai, kèm giải thích lý do bằng tiếng Việt rõ ràng:

  • ❌ Get-AzVM
    Lệnh PowerShell Az module để lấy thông tin tổng quát về VM (như size, status, hardware). Nó không hiển thị object ID của managed identity trực tiếp trong output chuẩn (chỉ có identity type: SystemAssigned). Phải dùng lệnh riêng như Get-AzVM -ResourceGroupName rg -Name vm | Get-AzVMIdentity mới lấy được, nên không phù hợp cho nhiệm vụ chính xác và scale 100 VMs.

  • ❌ Get-AzureADUserOwnedObject
    Lệnh này không tồn tại trong Azure PowerShell hoặc Azure AD module (cũ AzureAD đã deprecated từ 2023, thay bằng Microsoft.Graph). Không liên quan đến VM identities (chỉ dùng cho objects thuộc user cụ thể). Hoàn toàn sai và sẽ báo lỗi nếu chạy.

  • ❌ az ad sp credential list
    Lệnh Azure CLI liệt kê passwords/keys/credentials của service principal (SP) đã biết appId. Nó không lấy object ID (object ID không phải credential), và yêu cầu appId trước (phải query riêng). Không dùng cho system-assigned identities vì chúng tự động, không expose credentials. Sai cho scale 100 VMs.

  • ✅ az resource show
    Như đã giải thích ở trên: Lấy chính xác object ID từ identity.principalId qua resource ID của VM. Hỗ trợ batch scripting, query output, và quyền tối thiểu (Reader role). Đúng 100% theo best practices Azure 2026.

🧠 Lời khuyên thực hành: Để xử lý 100 VMs, dùng script Bash/PowerShell loop qua az vm list --query "[].id" -o tsv | xargs -I {} az resource show --ids {} --query identity.principalId. Test trên Azure Cloud Shell để verify!