נבדק לאחרונה: מאי 2026
בנו את שירותי AWS של בחינת AZ-204 עם Terraform פשוט — בלוק אחד בכל פעם, כאשר כל אחד מהם מקושר בחזרה לתחום במבחן. אותו הקוד עובד גם ב-OpenTofu.
בסיום מעבדה זו תצרו, באמצעות Terraform רגיל, את אפליקציית האינטרנט הקנונית של Azure PaaS – תוכנית App Service + אפליקציית אינטרנט לינוקס עם זהות מנוהלת, חשבון Cosmos DB עבור מצב, סביבת עבודה של Application Insights לטלמטריה, וחשבון אחסון שהאפליקציה יכולה להשתמש בו לעבודות קבצים/בלובים. חמש יחידות; ארכיטקטורת הייחוס של AZ-204.
השליכו את הקטעים לקובץ main.tf יחיד, הריצו terraform init, ולאחר מכן terraform apply צעד אחר צעד.
>= 1.5 או OpenTofu >= 1.6.az login).az webapp deploy). מעבדה זו מספקת את מעטפת התשתית – פריסת קוד היא תחום ה-Implement DevOps של AZ-204 וקיימת מחוץ ל-Terraform.הערימה כולה צורכת כ-13$ לחודש במצב סרק עם תוכנית B1. עברו ל-F1 לבדיקה חינם (הסירו את הזהות המנוהלת בשלב 3) או מחקו במהירות.
פתיחת Azure סטנדרטית. שמות של אפליקציות אינטרנט ב-App Service חייבים להיות ייחודיים גלובלית (מפורסמים ב-DNS כ-<name>.azurewebsites.net) – random_id מתחמק מהתנגשויות.
terraform {
required_version = ">= 1.5"
required_providers {
azurerm = { source = "hashicorp/azurerm", version = "~> 4.0" }
random = { source = "hashicorp/random", version = "~> 3.6" }
}
}
provider "azurerm" {
features {}
}
resource "random_id" "suffix" {
byte_length = 3
}
locals {
tags = {
Project = "certlabpro-az-204"
ManagedBy = "terraform"
}
}
resource "azurerm_resource_group" "main" {
name = "certlabpro-az-204-rg"
location = "eastus"
tags = local.tags
}AZ-204 מצפה שתבחרו ב-Cosmos DB בכל פעם שהשאלה מציינת מילישניות בודדות בקנה מידה, מבוזר גלובלית, או NoSQL עם שאילתות דמויות SQL. מצב קיבולת ללא שרת (Serverless) הוא ברירת המחדל לאופטימיזציה של עלויות – תשלום לפי RU, 0$ במצב סרק, ונבדק בבחינה כבחירה הנכונה לסביבות נפח נמוך / פיתוח.
אנו יוצרים את החשבון, מסד נתונים אחד תחתיו, וקונטיינר אחד עם מפתח חלוקה. בחירת מפתח החלוקה (/userId כאן) היא שאלת ה-Cosmos הנבדקת ביותר ב-AZ-204 – מפתחות חלוקה גרועים גורמים למחיצות חמות; טובים מפיצים עומס באופן שווה. הבחינה בוחנת תבנית זו עם תרחישי קרדינליות.
resource "azurerm_cosmosdb_account" "main" {
name = "certlabpro-az-204-${random_id.suffix.hex}"
resource_group_name = azurerm_resource_group.main.name
location = azurerm_resource_group.main.location
offer_type = "Standard"
kind = "GlobalDocumentDB"
capabilities {
name = "EnableServerless"
}
consistency_policy {
consistency_level = "Session"
}
geo_location {
location = azurerm_resource_group.main.location
failover_priority = 0
}
tags = local.tags
}
resource "azurerm_cosmosdb_sql_database" "app" {
name = "appdb"
resource_group_name = azurerm_resource_group.main.name
account_name = azurerm_cosmosdb_account.main.name
}
resource "azurerm_cosmosdb_sql_container" "users" {
name = "users"
resource_group_name = azurerm_resource_group.main.name
account_name = azurerm_cosmosdb_account.main.name
database_name = azurerm_cosmosdb_sql_database.app.name
partition_key_paths = ["/userId"]
}התחומים Implement Azure Security ו-Monitor, Troubleshoot, and Optimize בבחינת AZ-204 נשענים שניהם על Application Insights – שירות ה-APM עבור מעקבים מבוזרים, מעקב תלות, לכידת חריגות ומדדים חיים. מופעי App Insights מודרניים דורשים סביבת עבודה של Log Analytics כ-backend הנתונים שלהם (מצב מבוסס סביבת עבודה; מצב קלאסי הוצא משימוש).
אנו יוצרים את שניהם ומפתח התיעול + מחרוזת החיבור מגיעים כמאפייני App Insights – ומחוברים ל-App Service בשלב 4 באמצעות הגדרות האפליקציה.
resource "azurerm_log_analytics_workspace" "main" {
name = "certlabpro-az-204-logs"
resource_group_name = azurerm_resource_group.main.name
location = azurerm_resource_group.main.location
sku = "PerGB2018"
retention_in_days = 30
tags = local.tags
}
resource "azurerm_application_insights" "main" {
name = "certlabpro-az-204-appi"
resource_group_name = azurerm_resource_group.main.name
location = azurerm_resource_group.main.location
workspace_id = azurerm_log_analytics_workspace.main.id
application_type = "web"
tags = local.tags
}App Service הוא מארח האינטרנט PaaS המועדף בבחינת AZ-204. ה-App Service Plan הוא מיכל החישוב (חשבו על EC2 מתחת להפשטה); אפליקציות אינטרנט בתוכו חולקות את החישוב של התוכנית. אנו משתמשים בתוכנית Linux B1 ובאפליקציית אינטרנט אחת עם סביבת ריצה Node.js 20 – החליפו ל-python, dotnet, java, או php כדי להתאים לערימה שלכם.
הזהות המנוהלת המוקצית למערכת (system-assigned managed identity) היא התשובה של AZ-204 לאישורים ללא סיסמה עבור האפליקציה הניגשת לשירותי Azure אחרים (Key Vault, Storage, Cosmos DB). לאחר שהוקצו תפקידי RBAC במשאבים אלה, ה-App Service קורא להם באמצעות אסימונים שהונפקו על ידי Entra – ללא מחרוזות חיבור בהגדרות האפליקציה.
בלוק app_settings מחדיר משתני סביבה: מחרוזת חיבור של App Insights, נקודת קצה של Cosmos, ודגל. אפליקציית האינטרנט מתחילה כמעטפת ריקה – הקוד נפרס בנפרד. המעבדה עוסקת ביישום נכון של התשתית.
resource "azurerm_service_plan" "main" {
name = "certlabpro-az-204-plan"
resource_group_name = azurerm_resource_group.main.name
location = azurerm_resource_group.main.location
os_type = "Linux"
sku_name = "B1"
tags = local.tags
}
resource "azurerm_linux_web_app" "main" {
name = "certlabpro-az-204-${random_id.suffix.hex}"
resource_group_name = azurerm_resource_group.main.name
location = azurerm_service_plan.main.location
service_plan_id = azurerm_service_plan.main.id
https_only = true
site_config {
always_on = true
application_stack {
node_version = "20-lts"
}
}
identity {
type = "SystemAssigned"
}
app_settings = {
APPLICATIONINSIGHTS_CONNECTION_STRING = azurerm_application_insights.main.connection_string
COSMOS_ENDPOINT = azurerm_cosmosdb_account.main.endpoint
WEBSITES_ENABLE_APP_SERVICE_STORAGE = "false"
}
tags = local.tags
}
# Grant the web app's managed identity Cosmos DB data-plane access
# (Cosmos DB Built-in Data Contributor — the AZ-204 password-less pattern).
resource "azurerm_cosmosdb_sql_role_assignment" "webapp" {
resource_group_name = azurerm_resource_group.main.name
account_name = azurerm_cosmosdb_account.main.name
role_definition_id = "${azurerm_cosmosdb_account.main.id}/sqlRoleDefinitions/00000000-0000-0000-0000-000000000002"
principal_id = azurerm_linux_web_app.main.identity[0].principal_id
scope = azurerm_cosmosdb_account.main.id
}כל אפליקציית אינטרנט Azure PaaS זקוקה בסופו של דבר לאחסון בלובים/קבצים – קבצים שהועלו, אווטארים למשתמשים, קובצי PDF שנוצרו, תמונות מעובדות. אנו מקצים את החשבון עם ברירות מחדל מאובטחות סטנדרטיות ומעניקים לזהות המנוהלת של האפליקציה תפקיד Storage Blob Data Contributor כך שהאפליקציה תוכל לקרוא/לכתוב בלובים ללא מחרוזת חיבור.
זה סוגר את מעגל ה-Develop Azure Compute Solutions של AZ-204: אפליקציה + מצב (Cosmos) + טלמטריה (App Insights) + אחסון בלובים, כולם מחוברים באמצעות זהות מנוהלת במקום סודות. כל תבנית AZ-204 נוספת (תור Service Bus, נושא Event Grid, סודות Key Vault, אינטגרציית Logic App) מתחברת באותה צורה – העניקו לזהות המנוהלת את התפקיד הנכון בטווח הנכון.
resource "azurerm_storage_account" "app_blobs" {
name = "az204app${random_id.suffix.hex}"
resource_group_name = azurerm_resource_group.main.name
location = azurerm_resource_group.main.location
account_tier = "Standard"
account_replication_type = "LRS"
account_kind = "StorageV2"
https_traffic_only_enabled = true
min_tls_version = "TLS1_2"
allow_nested_items_to_be_public = false
tags = local.tags
}
resource "azurerm_role_assignment" "webapp_blobs" {
scope = azurerm_storage_account.app_blobs.id
role_definition_name = "Storage Blob Data Contributor"
principal_id = azurerm_linux_web_app.main.identity[0].principal_id
}terraform destroy מפרק הכל. ה-App Service Plan B1 הוא הפריט החיוב הפועל 24/7 (כ-13$ לחודש). התוכנית נשארת בקבוצת המשאבים גם לאחר הסרת אפליקציית האינטרנט אם מבצעים scale-in בצורה שגויה – terraform destroy מסיר את שניהם. Cosmos DB serverless ו-App Insights מפסיקים לחייב מיד עם המחיקה.
AZ-204 מכסה שירותי מפתחים נוספים שמעבדה זו אינה יכולה להכיל – Azure Functions (ללא שרת מונחה אירועים), Container Apps, AKS, Service Bus, Event Grid, Event Hubs, Logic Apps, Durable Functions, API Management, Front Door, CDN, Notification Hubs, SignalR, ו-Azure Key Vault לאחסון סודות (מעקב נפוץ ב-AZ-204 לאחר זהות מנוהלת).
אנו נצמדים לבסיס ה-App Service + Cosmos + App Insights + Storage מכיוון שזוהי צורת אפליקציית האינטרנט PaaS הנבדקת ביותר בבחינה – וכל תבנית AZ-204 אחרת (Functions, Service Bus, Key Vault) מתחברת לבסיס זה באמצעות זהות מנוהלת + RBAC.
לגבי השירותים לעיל, עיין בקטגוריות עיון, מדריך, ו-Editorial בדף אישור זה.