ข้ามไปยังเนื้อหา
AggregaAggregaAggregaAggrega
เลือกภาษา: ไทย
หน้านี้ถูกแปลด้วยเครื่อง อ่านต้นฉบับภาษาอังกฤษ

นำเข้าเทมเพลต Azure Resource Manager

บทแนะนำนี้นำเข้าเทมเพลต Azure Resource Manager ขนาดเล็ก — เนมสเปซ Event Hubs ที่ปรับใช้ผ่านโมดูล Azure Verified Modules ไซต์ App Service ที่รันคอนเทนเนอร์ เว็บแอปแบบสถิต และเครือข่ายเสมือนที่ไซต์ตั้งใจจะเข้าร่วม — แล้วบิลด์ผลที่ได้เป็นเทมเพลต Azure Resource Manager เดียว การนำเข้าร่าง Aggregate, Release และ Manifest: เนมสเปซและไซต์กลายเป็นการอ้างอิงถึง Components ของไลบรารีมาตรฐาน เว็บแอปแบบสถิตซึ่งไม่มี Component ใดแทนได้ถูกร่างจากเทมเพลต และค่าที่เทมเพลตระบุในรูปแบบที่ Release รับได้ถูกบรรจุไปยัง Release ค่าบางรายการที่เทมเพลตไม่ระบุในรูปแบบนั้นถูกฝากไว้ให้คุณ และหน้านี้แสดงว่าค่าใดและอยู่ที่ใด ทุกไฟล์และทุกบล็อกของเอาต์พุตด้านล่างมาจากการรันจริง เทมเพลตและทุกขั้นของบทแนะนำอยู่ในตัวอย่าง import-arm ซึ่งสคริปต์ตรวจสอบรันการนำเข้าอีกครั้ง เปรียบเทียบสิ่งที่การนำเข้าเขียน สิ่งที่พิมพ์ และบล็อกที่หน้านี้อ้างอิงกับไฟล์ที่เก็บไว้ที่นั่น ยืนยันว่าฉบับร่างหยุดตรงที่หน้านี้บอก และบิลด์ Release ที่ตรวจทานแล้ว

ร่างตัวอย่าง

คุณรันการนำเข้านี้ด้วยคำสั่งในหน้านี้ได้ หรือ ให้ผู้ช่วย AI ของคุณรันให้

เขียนตัวอย่างลงในโฟลเดอร์ใหม่ที่ตั้งชื่อตามตัวอย่าง:

Terminal window
aggrega draft --example import-arm

จากนั้นจะพิมพ์คำสั่งที่ต้องรันต่อ คำสั่งแรกเปลี่ยนเข้าโฟลเดอร์ใหม่ ส่วนคำสั่งถัดไปด้านล่างเปลี่ยนเข้าโฟลเดอร์ source ซึ่งมีสิ่งที่หน้านี้นำเข้าและเป็นที่ที่การนำเข้ารัน:

Terminal window
cd import-arm

เทมเพลต

main.json คือรูปแบบที่คอมไพล์แล้วของเทมเพลต: JSON ที่การบิลด์ Bicep เขียนขึ้นและ Azure Resource Manager ปรับใช้ พารามิเตอร์ของเทมเพลตคือภูมิภาค และเทมเพลตเริ่มด้วยเครือข่ายเสมือนที่มีซับเน็ตซึ่งไซต์เข้าร่วม:

{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string",
"defaultValue": "westeurope"
}
},
"resources": [
{
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2023-11-01",
"name": "vnet-notes",
"location": "[parameters('location')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"10.20.0.0/16"
]
},
"subnets": [
{
"name": "snet-app",
"properties": {
"addressPrefix": "10.20.1.0/24",
"delegations": [
{
"name": "web",
"properties": {
"serviceName": "Microsoft.Web/serverFarms"
}
}
]
}
}
]
}
},
[… omitted: the rest of the template]

เนมสเปซปรับใช้ผ่านโมดูล Azure Verified Modules avm/res/event-hub/namespace เวอร์ชัน 0.15.3: ทรัพยากร Microsoft.Resources/deployments ที่สมาชิก template บรรจุเทมเพลตที่คอมไพล์แล้วของโมดูลเอง ยาวกว่า 3,700 บรรทัด และ parameters ของทรัพยากรนั้นคือค่าที่เทมเพลตกำหนดให้โมดูล:

{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2022-09-01",
"name": "ehModule",
"properties": {
"mode": "Incremental",
"expressionEvaluationOptions": {
"scope": "inner"
},
"parameters": {
"name": {
"value": "evh-notes"
},
"location": {
"value": "[parameters('location')]"
},
"skuName": {
"value": "Standard"
},
"skuCapacity": {
"value": 2
},
"publicNetworkAccess": {
"value": "Enabled"
},
"enableTelemetry": {
"value": true
}
},
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
[… omitted: the module's compiled template, and the rest of the resource]

เทมเพลตที่คอมไพล์แล้วของโมดูลคือตัวที่ Microsoft Container Registry ให้บริการสำหรับเวอร์ชันนั้น ใช้สัญญาอนุญาต MIT และ README ของตัวอย่าง มีประกาศไว้ การนำเข้าอ่านเทมเพลตนี้เพื่อรู้จักโมดูล: คำนำหน้าเทเลเมทรีและเวอร์ชันของเทมเพลตระบุโมดูล Azure Verified Modules และชนิดทรัพยากรที่โมดูลปรับใช้

ไซต์เป็นทรัพยากรธรรมดา ทำงานบนแผน App Service ที่มีอยู่แล้ว เข้าร่วมซับเน็ตของเทมเพลต รันคอนเทนเนอร์ที่ระบุใน linuxFxVersion อ่านเอาต์พุต name ของโมดูล และตั้งค่าตัวแปรเพิ่มอีกตัว:

{
"type": "Microsoft.Web/sites",
"apiVersion": "2023-12-01",
"name": "notes-api",
"location": "[parameters('location')]",
"kind": "app,linux,container",
"dependsOn": [
"[resourceId('Microsoft.Resources/deployments', 'ehModule')]",
"[resourceId('Microsoft.Network/virtualNetworks', 'vnet-notes')]"
],
"properties": {
"serverFarmId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/notes-platform/providers/Microsoft.Web/serverfarms/plan-notes",
"virtualNetworkSubnetId": "[resourceId('Microsoft.Network/virtualNetworks/subnets', 'vnet-notes', 'snet-app')]",
"siteConfig": {
"linuxFxVersion": "DOCKER|ghcr.io/example/notes-api:2.3.0",
"appSettings": [
{
"name": "EVENTHUB_NAMESPACE",
"value": "[reference('ehModule').outputs.name.value]"
},
{
"name": "EVENTHUB_NAME",
"value": "notes"
}
]
}
}
},

เว็บแอปแบบสถิตก็เป็นทรัพยากรธรรมดาเช่นกัน ข้างเทมเพลตมีไฟล์พารามิเตอร์ที่จัดหาพารามิเตอร์ตัวเดียว:

{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": { "value": "northeurope" }
}
}

ไฟล์ทั้งสองอยู่ในโฟลเดอร์ notes และ .aggrega-config.yaml ที่อยู่ข้างโฟลเดอร์นั้นทำให้ไดเรกทอรีเป็นพื้นที่ทำงาน การนำเข้าจึงเขียนฉบับร่างไว้ที่นั่น:

# The workspace key marks this directory as the workspace root, so an import run
# here writes its drafts beside the notes folder.
workspace: {}
# The registry the importer is fetched from the first time an import needs it.
default_registry: hub.aggrega.ai

การนำเข้าอ่านเทมเพลตและไฟล์พารามิเตอร์ของเทมเพลตเป็น JSON ที่มีความคิดเห็น โดยรู้จักเทมเพลตจาก $schema และ resources และรู้จักไฟล์พารามิเตอร์จาก $schema และ parameters การนำเข้าชั่งน้ำหนักแต่ละทรัพยากรกับ Components ของแค็ตตาล็อกของพื้นที่ทำงาน ซึ่งอ่านตามที่ วิธีที่การนำเข้าทำงาน อธิบายไว้ และไม่อ่านบัญชีคลาวด์เลย: ค่าที่เทมเพลตคำนวณขณะปรับใช้ถูกบรรจุไว้เป็นนิพจน์ที่คำนวณค่านั้น โดยไม่ค้นหาค่าเลย

เปลี่ยนเข้าโฟลเดอร์ source:

Terminal window
cd source

รันการนำเข้า

ระบุชื่อโฟลเดอร์ที่มีเทมเพลต ตัวนำเข้ารู้จักเทมเพลตและไฟล์พารามิเตอร์ของเทมเพลตจากเนื้อหาของไฟล์:

Terminal window
aggrega import notes

ไม่มีการระบุ --target ตัวนำเข้าประกาศ arm เป็นเป้าหมายเริ่มต้น เพราะ Recipes ของไลบรารีมาตรฐานสำหรับ Azure Resource Manager ผูกกับเป้าหมายนั้น และการนำเข้าร่าง Manifest สำหรับเป้าหมายนั้น ส่วนการนำเข้าที่ระบุเป้าหมายด้วย --target จะร่างสำหรับเป้าหมายนั้นแทน บันทึกที่การนำเข้าเขียนไว้ข้างฉบับร่างเก็บเป้าหมายไว้ และ --sync นำบันทึกนั้นกลับมาใช้ใหม่

ที่เอาต์พุตมาตรฐาน การนำเข้าแสดงสิ่งที่เขียน:

wrote aggregate.yaml
wrote release.yaml
wrote manifest.yaml
wrote catalog/component/imported/compute/microsoft-web-staticsites/0.1.0/component.yaml
wrote catalog/recipe/arm/microsoft-web-staticsites/0.1.0/recipe.yaml
wrote .aggrega-import.json

ที่ข้อผิดพลาดมาตรฐาน โดยที่ <workspace> แทนโฟลเดอร์ที่คุณรัน:

[… omitted: a warning that the importer runs unverified, printed where its module is read from beside its Plugin entity in a catalog folder rather than fetched]
read as the arm format, with drafted paths relative to <workspace>
info: the drafts are for the target "arm", the importer's declared default; an import naming a target drafts for that one
info: ehmodule deploys the Azure Verified Modules resource module avm/res/event-hub/namespace, of telemetry prefix 46d3xbcp.res.962075c, version 0.15.3, named "Event Hub Namespaces" in its metadata: it is one node of the resource type Microsoft.EventHub/namespaces, the parameters it sets read as the module's, and the module's telemetry is not carried, as whether a Recipe sends telemetry is the Recipe's to set
warn: notes-api sets the variable EVENTHUB_NAMESPACE at properties.siteConfig.appSettings.0.value from ehmodule's outputs.name.value, and the drafted Aggregate does not wire it: ehmodule publishes no provides key for it; the instance notes-api is connected to ehmodule for the dependency alone, a comment above the connection saying why; write the value where the instance is configured
info: the resource notes-site of the type Microsoft.Web/staticSites@2023-01-01 is drafted from the source as the Component imported/compute/microsoft-web-staticsites and the Recipe microsoft-web-staticsites on arm, carrying the properties the source writes; the decision's swap hint names the import drafting it from the vendor's schema
warn: the source creates substrate the draft leaves to the operator and drafts nothing for: vnet-notes (Microsoft.Network/virtualNetworks), of which the format says the network a component runs in is the operator's: a component of the catalog takes it by its resource ID under infra.overrides, reading the parameter location at location; provide each where the Release deploys, and fill the pointers the Release leaves for them
warn: notes-api sets the variable EVENTHUB_NAME in the environment of the instance notes-api, and the draft delivers an instance's environment from its connections alone, so the variable is not carried: the instance's Release entry names it, for the author to set where the instance is configured
mapped ehmodule (Microsoft.EventHub/namespaces) to core/messaging/azure-event-hubs as a reference, HIGH at 0.8656
mapped notes-site (Microsoft.Web/staticSites) to imported/compute/microsoft-web-staticsites as a draft, NONE at 0.05
made no choice for vnet-notes (Microsoft.Network/virtualNetworks)
mapped notes-api (Microsoft.Web/sites) to core/compute/server as a reference, HIGH at 0.9
made no choice for resourceId('Microsoft.Network/virtualNetworks/subnets', 'vnet-notes', 'snet-app') ()
[… omitted: what the pull could not render yet, a stop of the App Service Recipe's assertion that the Release names the subnet, which the sections below explain]
external inputs: dependency pins were written and are complete; 0 external input(s) pinned, and any this Release also needs are still unpinned
external inputs: a build of this Release halts naming the unpinned URL; fixing what stopped the render and resolving again pins it
Pull complete: <workspace>/release.lock (entities=8, source_artifacts=0, external_inputs=0)
External inputs were not fully discovered: dependency pins are complete, external-input pins may not be (see the diagnostics above)
  • บรรทัด info ระบุสิ่งที่ตัวนำเข้าตัดสินใจโดยไม่ต้องถาม บรรทัดแรกบอกว่าฉบับร่างสำหรับ arm บรรทัดที่สองรู้จักโมดูล: ทรัพยากร ehmodule คือโมดูล Azure Verified Modules ของเนมสเปซ Event Hubs และพารามิเตอร์ที่เทมเพลตกำหนดให้เนมสเปซนั้นอ่านเป็นพารามิเตอร์ของโมดูลเอง ฉบับร่างจึงถือว่าเป็นเนมสเปซเดียว ไม่ใช่เทมเพลตซ้อนที่ต้องอ่าน บรรทัดที่สามบอกว่าเว็บแอปแบบสถิตถูกร่างจากเทมเพลต
  • บรรทัด warn ระบุสิ่งที่ฉบับร่างไม่บรรจุ บรรทัดแรกคือตัวแปรที่ไซต์อ่านจากเอาต์พุต name ของโมดูล: ฉบับร่างเชื่อมโยงการเชื่อมต่อเฉพาะสิ่งที่ Component เผยแพร่ และเนมสเปซไม่เผยแพร่คีย์สำหรับชื่อของตน การเชื่อมต่อจึงมีไว้เพื่อการพึ่งพาเท่านั้น บรรทัดที่สองระบุเครือข่ายเสมือนที่เทมเพลตสร้าง ซึ่งฉบับร่างฝากไว้ให้คุณ ดังที่ สิ่งที่ฉบับร่างฝากไว้ให้คุณ อธิบาย บรรทัดที่สามระบุตัวแปรที่ไซต์ตั้งค่าซึ่งไม่มีการเชื่อมต่อใดของฉบับร่างส่งมอบ
  • บรรทัด mapped บอกว่าแต่ละทรัพยากรกลายเป็นอะไร ehmodule คืออินสแตนซ์ของ core/messaging/azure-event-hubs ของไลบรารีมาตรฐาน และ notes-api คืออินสแตนซ์ของเซิร์ฟเวอร์ทั่วไป core/compute/server โดยแต่ละรายการจับคู่ในชั้นสูงและถูกอ้างอิง notes-site ไม่จับคู่กับ Component ใดเลย จึงเป็นฉบับร่างที่ไม่มีการจับคู่ บรรทัด made no choice ระบุสิ่งที่ฉบับร่างไม่ตัดสินใจให้: เครือข่ายเสมือน และตัวชี้ซับเน็ตที่ Release ปล่อยให้ว่าง
  • การ pull คือการที่การนำเข้าดึงสิ่งที่ Release ที่ร่างขึ้นพึ่งพา ดังที่ aggrega pull ทำ ลงใน release.lock Recipes ที่ Manifest ระบุสำหรับเนมสเปซและไซต์เขียนทรัพยากรของตนเองและไม่ดึงซอร์สใดเลย source_artifacts จึงเป็น 0 และ pull ไม่ต้องออกไปนอกแค็ตตาล็อกเพื่อสิ่งใด จากนั้นการนำเข้าพยายามเรนเดอร์ Release เพื่อหาอินพุตที่การบิลด์จะดึง และ Recipe App Service หยุดการเรนเดอร์นั้น: ฉบับร่างยังไม่ระบุซับเน็ต การนำเข้ายังจบลงโดยเขียนไฟล์ล็อกแล้ว และบอกว่าอินพุตภายนอกยังค้นพบไม่ครบ การหยุดนี้คือการหยุดเดียวกับที่การตรวจสอบความถูกต้องรายงานต่อไป

สิ่งที่การนำเข้าเขียน

Aggregate, Release และ Manifest ใช้ชื่อ imported/notes ตามโฟลเดอร์ที่การนำเข้าอ่าน — เทมเพลตที่นำเข้าเป็นไฟล์ใช้ชื่อตามไฟล์ คือ main — ภายใต้เนมสเปซที่การตั้งค่า target_namespace ของตัวนำเข้ากำหนด ซึ่งคือ imported เว้นแต่คุณกำหนดเนมสเปซอื่น (การตั้งค่า)

aggregate.yaml — หนึ่งรายการต่อทรัพยากร และการเชื่อมต่อที่ไซต์วาดขึ้น:

# Sources read: main.json, main.parameters.json.
# Substrate the source creates, left to the operator: vnet-notes (Microsoft.Network/virtualNetworks).
apiVersion: aggrega.ai/v1beta1
kind: Aggregate
metadata:
name: imported/notes
version: 0.1.0
description: Draft Aggregate imported from a source in the arm format.
spec:
components:
ehmodule:
type: core/messaging/azure-event-hubs
notes-site:
type: imported/compute/microsoft-web-staticsites
values:
name: "notes-site"
notes-api:
type: core/compute/server
uses:
# Not wired: notes-api sets the variable EVENTHUB_NAMESPACE at properties.siteConfig.appSettings.0.value from ehmodule's outputs.name.value; ehmodule publishes no provides key for it.
ehmodule:
ehmodule:
target: ehmodule

เว็บแอปแบบสถิตคือส่วนประกอบของชนิดที่การนำเข้าร่างขึ้น imported/compute/microsoft-web-staticsites การเชื่อมต่อของไซต์ไปยังเนมสเปซไม่มีบล็อก inject เพราะฉบับร่างส่งมอบตัวแปรจากการเชื่อมต่อเฉพาะเมื่อ Component เผยแพร่ค่านั้น และความคิดเห็นเหนือการเชื่อมต่อระบุว่าตัวแปรใดที่ไม่ได้เชื่อมโยงและเพราะเหตุใด

release.yaml — สภาพแวดล้อม และการตั้งค่าของแต่ละทรัพยากร:

apiVersion: aggrega.ai/v1beta1
kind: Release
metadata:
name: imported/notes
# environment is a drafted default, since no source names the environment this Release deploys to; change it to name the one it deploys to.
environment: development
version: 0.1.0
description: Draft Release imported from a source in the arm format.
spec:
aggregate: imported/notes
manifest: imported/notes
components:
# Module parameters the source sets and the draft does not translate: location, name, publicNetworkAccess, skuCapacity, skuName.
ehmodule: {}
notes-site:
infra:
# From the template parameter location, the value the parameters file supplies.
location: "northeurope"
overrides:
appLocation: "/"
outputLocation: "dist"
name: "Free"
tier: "Free"
# Properties the source writes and the draft does not place: kind, properties.siteConfig.linuxFxVersion.
# Environment variables the source sets and no connection delivers: EVENTHUB_NAME = notes.
notes-api:
infra:
overrides:
service_plan_id: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/notes-platform/providers/Microsoft.Web/serverfarms/plan-notes"
# From the template parameter location, the value the parameters file supplies.
location: "northeurope"
# Left for the Release, since the source cannot supply it: infra.overrides.virtual_network_subnet_id, the pointer to the resource "resourceId('Microsoft.Network/virtualNetworks/subnets', 'vnet-notes', 'snet-app')", which the draft leaves to the operator and the source names as "[resourceId('Microsoft.Network/virtualNetworks/subnets', 'vnet-notes', 'snet-app')]"; the catalog Recipe takes the resource's literal identifier: write it
virtual_network_subnet_id: ""

สภาพแวดล้อม development เป็นค่าเริ่มต้นที่การนำเข้าเขียนให้ เพราะไม่มีเทมเพลตใดระบุชื่อสภาพแวดล้อม พารามิเตอร์ location ของเทมเพลตไปถึงรายการของเว็บแอปแบบสถิตและของไซต์ในรูปค่าที่ไฟล์พารามิเตอร์จัดหา คือ northeurope service_plan_id ของไซต์ถูกบรรจุเป็นตัวระบุตามตัวอักษรที่เทมเพลตเขียน รายการของเนมสเปซว่างอยู่ และความคิดเห็นเหนือรายการนั้นระบุพารามิเตอร์ของโมดูลที่ฉบับร่างไม่แปล

คีย์หนึ่งว่างอยู่ และความคิดเห็นของคีย์นั้นบอกเหตุผล: virtual_network_subnet_id คือตัวชี้ไปยังทรัพยากร ซึ่ง Recipes ของไลบรารีมาตรฐานสำหรับ Azure Resource Manager รับเป็นตัวระบุ /subscriptions/… ตามตัวอักษรของทรัพยากร เทมเพลตเขียนซับเน็ตของไซต์เป็นนิพจน์ resourceId ที่ระบุทรัพยากรของเทมเพลตเอง และนิพจน์ไม่ใช่ตัวระบุที่ Recipe รับได้ ฉบับร่างจึงปล่อยคีย์ว่างและระบุนิพจน์นั้นไว้ในความคิดเห็น ในทางตรงข้าม ทรัพยากรที่ร่างขึ้นเก็บทุกนิพจน์ของเทมเพลตไว้ครบ

อิมเมจคอนเทนเนอร์ไม่อยู่ในรายการ เทมเพลตเขียนอิมเมจไว้ภายใน linuxFxVersion ซึ่งเป็นคุณสมบัติที่ฉบับร่างไม่วางไว้ที่ใดเลย และความคิดเห็นเหนือรายการระบุ kind และ linuxFxVersion ไว้ในคุณสมบัติที่ฉบับร่างไม่วาง

manifest.yaml — Recipe ที่ทำให้แต่ละส่วนประกอบเป็นรูปธรรมบน arm:

apiVersion: aggrega.ai/v1beta1
kind: Manifest
metadata:
name: imported/notes
version: 0.1.0
spec:
mappings:
components:
type: {}
name:
ehmodule: arm/azure-event-hubs
notes-site: arm/microsoft-web-staticsites
notes-api: arm/server-app-service

เว็บแอปแบบสถิตไม่มี Component ในไลบรารีมาตรฐาน การนำเข้าจึงร่าง Component พร้อม Recipe ไว้ใต้โฟลเดอร์ catalog ของพื้นที่ทำงาน: Component imported/compute/microsoft-web-staticsites ประกาศค่า name ที่เทมเพลตตั้งให้เว็บไซต์ ค่า location และออบเจ็กต์ overrides สำหรับทุกคุณสมบัติที่เทมเพลตเขียน โดยใช้ชื่อของผู้จำหน่ายเอง และ Recipe microsoft-web-staticsites เขียนทรัพยากร Microsoft.Web/staticSites หนึ่งรายการของชนิดและเวอร์ชัน API นั้น ฉบับร่างเป็นไฟล์ธรรมดาให้คุณอ่านและแก้ไข:

apiVersion: aggrega.ai/v1beta1
kind: Component
metadata:
name: imported/compute/microsoft-web-staticsites
version: 0.1.0
description: "Draft Component of the resource type Microsoft.Web/staticSites@2023-01-01, imported from a source in the arm format."
labels:
component.aggrega.ai/type: resource
component.aggrega.ai/category: compute
component.aggrega.ai/hosting: managed
spec:
schema:
values:
type: object
properties:
# identity: the resource's own name or identifier
# The source writing the resource gives no description of name.
name:
type: string
required: true
additionalProperties: false
infra:
type: object
properties:
# placement: where the resource is deployed
# The source writing the resource gives no description of location.
location:
type: string
required: true
# override: every writable property no other rule places, each under the vendor's own name
overrides:
type: object
description: "Writable settings of Microsoft.Web/staticSites@2023-01-01, each under the vendor's own name, which the Recipe passes to the resource as written; its header lists the names it reads."
additionalProperties: true
additionalProperties: false
[… omitted: the values the Component publishes, id and name]

release.lock บันทึกเอนทิตีแค็ตตาล็อกที่ Release หาค่าไปถึง ตามไดเจสต์ ส่วน .aggrega-import.json คือบันทึกของสิ่งที่การนำเข้าเขียน ซึ่ง aggrega import --sync ในภายหลังอ่าน

ตรวจสอบความถูกต้อง

Terminal window
aggrega validate --release release.yaml

การตรวจสอบความถูกต้องหยุดลง ฉบับร่างไม่ระบุซับเน็ตให้ไซต์ และ Recipe App Service เชื่อมไซต์เข้ากับซับเน็ตของเครือข่ายของคุณเองด้วยตัวระบุของซับเน็ตเท่านั้น:

[CATALOG_ERROR E0033]
Recipe/FeatureRecipe assertions
[… omitted: the line beginning "caused by: Recipe "server-app-service" instance "notes-api" assertion "placement_supplied"", which ends with the Recipe's message: … infra.overrides.virtual_network_subnet_id is "", and this Recipe takes the subnet the app joins by virtual network integration as the subnet's resource ID: set it to /subscriptions/<subscription>/resourceGroups/<group>/providers/Microsoft.Network/virtualNetworks/<network>/subnets/<subnet>, a subnet delegated to Microsoft.Web/serverFarms, or remove it]
release dependency validation failed: 1 diagnostic(s)

การปฏิเสธระบุสิ่งที่ต้องเปลี่ยนและตำแหน่งที่ต้องเปลี่ยน ในเอกสารที่คุณเปลี่ยน ในที่นี้คือรายการ notes-api ของ release.yaml และหลังซับเน็ต การบิลด์ระบุค่าที่สอง: อิมเมจคอนเทนเนอร์ เทมเพลตเขียนอิมเมจไว้ใน linuxFxVersion ซึ่งฉบับร่างไม่วาง และ Recipe ของเซิร์ฟเวอร์ทั่วไปสำหรับ App Service ไม่มีอิมเมจของตนเอง การบิลด์จึงหยุดพร้อมข้อความที่บอกว่า Release ไม่ได้ตั้งค่า infra.image อิมเมจเป็นสิ่งที่คุณต้องจัดหาใน Release

ความคิดเห็นของเนมสเปซระบุ skuName, skuCapacity และ location ซึ่งโมดูลรับจากเทมเพลตและฉบับร่างก็ไม่วางไว้เช่นกัน เมื่อไม่มีค่าเหล่านี้ ค่าเริ่มต้นของ Recipe เองจะมีผล infra.overrides.sku_name, infra.overrides.sku_capacity และ infra.overrides.location บรรจุค่าของเทมเพลต โฟลเดอร์ reviewed ของตัวอย่างมี release.yaml ที่เขียนค่าทั้งหมดไว้:

# Module parameters the source sets and the draft does not translate: location, name, publicNetworkAccess, skuCapacity, skuName.
ehmodule:
infra:
overrides:
# Where the template sets skuName and skuCapacity, which the draft places nowhere: the namespace's tier and its throughput units.
sku_name: "Standard"
sku_capacity: 2
# Where the template sets location, which the draft places nowhere on a module: the namespace's region.
location: "northeurope"

และรายการของไซต์ พร้อมอิมเมจและซับเน็ต:

# Properties the source writes and the draft does not place: kind, properties.siteConfig.linuxFxVersion.
# Environment variables the source sets and no connection delivers: EVENTHUB_NAME = notes.
notes-api:
infra:
# The template writes the container image in properties.siteConfig.linuxFxVersion, which the draft places nowhere: the image the site runs.
image: "ghcr.io/example/notes-api:2.3.0"
overrides:
service_plan_id: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/notes-platform/providers/Microsoft.Web/serverfarms/plan-notes"
# From the template parameter location, the value the parameters file supplies.
location: "northeurope"
# The subnet the template's virtual network holds, as the literal ID the Recipe takes, in the resource group the network is deployed to.
virtual_network_subnet_id: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/notes-network/providers/Microsoft.Network/virtualNetworks/vnet-notes/subnets/snet-app"

สคริปต์ตรวจสอบของตัวอย่างบิลด์ Release นี้ และยืนยันว่าฉบับร่างหยุดพร้อมข้อความข้างต้น

บิลด์

ไปที่โฟลเดอร์ที่มี Release ที่ตรวจทานแล้ว หรือแก้ไข release.yaml ใน source ในลักษณะเดียวกัน แล้วบิลด์:

Terminal window
aggrega validate --release release.yaml
aggrega build --release release.yaml --auto-pull

Release ไม่ตรงกับ release.lock ที่การนำเข้าเขียนไว้อีกต่อไป การบิลด์จึงต้องใช้ --auto-pull ซึ่งหาค่าอีกครั้ง หากไม่มี การบิลด์จะหยุดและระบุ aggrega pull การตรวจสอบความถูกต้องพิมพ์:

release dependency validation passed: release.yaml (schema-pillar + dependency pillars)

และบิลด์ โดยที่ <workspace> แทนโฟลเดอร์ที่คุณรัน:

[… omitted: the pull's line reporting the lockfile it wrote]
[… omitted: a total build time, which differs per run]
Build completed: 1 file written to <workspace>/dist

อ่าน arm-template.json

บิลด์เขียนไฟล์เดียวคือ dist/arm/arm-template.json ซึ่งเป็นเทมเพลตที่ประกอบแล้ว ในภาษาเวอร์ชัน 2.0 โดยมีหนึ่งรายการภายใต้ resources สำหรับทรัพยากรแต่ละรายการที่ส่วนประกอบเขียน ตั้งชื่อด้วย id ของอินสแตนซ์ของส่วนประกอบที่พับเป็นคำ:

Ehmodule the Event Hubs namespace, in a nested template
NotesApi the App Service site
NotesApiFtpPublishing the site's FTP publishing policy, which the Recipe turns off
NotesApiScmPublishing the site's SCM publishing policy, which the Recipe turns off
NotesSite the static web app, the resource the draft Recipe writes

รายการของเนมสเปซบรรจุเนมสเปซที่ Recipe เขียน พร้อมการตั้งค่าที่ Release บรรจุ — ระดับ หน่วยปริมาณงาน และภูมิภาค — และค่าของ Recipe เองสำหรับส่วนที่เหลือ:

"Ehmodule": {
"apiVersion": "2025-04-01",
"metadata": {
"aggrega.ai/provenance": {
"aggrega.ai/aggregate-name": "imported/notes",
"aggrega.ai/boundary-path": "default",
[… omitted: a compiler-version entry, which moves with the build]
"aggrega.ai/component-id": "ehmodule",
"aggrega.ai/environment": "development",
"aggrega.ai/provider": "arm",
[… omitted: a provider-version entry, which moves with the build]
"aggrega.ai/recipe-uri": "azure-event-hubs:1.0.0"
}
},
"name": "[format('Ehmodule-{0}', uniqueString(deployment().name))]",
"properties": {
"expressionEvaluationOptions": {
"scope": "inner"
},
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"outputs": {
"serviceBusEndpoint": {
"type": "string",
"value": "[reference(resourceId('Microsoft.EventHub/namespaces', 'ehmodule'), '2026-01-01').serviceBusEndpoint]"
}
},
"resources": [
{
"apiVersion": "2026-01-01",
"location": "northeurope",
"name": "ehmodule",
"properties": {
"disableLocalAuth": true,
"isAutoInflateEnabled": false,
"minimumTlsVersion": "1.2",
"publicNetworkAccess": "Enabled"
},
"sku": {
"capacity": 2,
"name": "Standard",
"tier": "Standard"
},
"type": "Microsoft.EventHub/namespaces"
}
]
}
},
"type": "Microsoft.Resources/deployments"
},

รายการของไซต์บรรจุแผน ซับเน็ต อิมเมจในฐานะคอนเทนเนอร์ที่ไซต์รัน และพอร์ตที่เซิร์ฟเวอร์ทั่วไปประกาศ:

"NotesApi": {
"apiVersion": "2025-03-01",
"kind": "app,linux,container",
"location": "northeurope",
"metadata": {
"aggrega.ai/provenance": {
"aggrega.ai/aggregate-name": "imported/notes",
"aggrega.ai/boundary-path": "default",
[… omitted: a compiler-version entry, which moves with the build]
"aggrega.ai/component-id": "notes-api",
"aggrega.ai/environment": "development",
"aggrega.ai/provider": "arm",
[… omitted: a provider-version entry, which moves with the build]
"aggrega.ai/recipe-uri": "server-app-service:1.0.0"
}
},
"name": "notes-api",
"properties": {
"clientAffinityEnabled": false,
"httpsOnly": true,
"publicNetworkAccess": "Disabled",
"serverFarmId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/notes-platform/providers/Microsoft.Web/serverfarms/plan-notes",
"siteConfig": {
"alwaysOn": true,
"appSettings": [
{
"name": "WEBSITES_PORT",
"value": "8080"
}
],
"ftpsState": "Disabled",
"linuxFxVersion": "DOCKER|ghcr.io/example/notes-api:2.3.0",
"minTlsVersion": "1.2",
"vnetRouteAllEnabled": true
},
"virtualNetworkSubnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/notes-network/providers/Microsoft.Network/virtualNetworks/vnet-notes/subnets/snet-app"
},
"type": "Microsoft.Web/sites"
},

ไซต์ได้รับ WEBSITES_PORT และไม่ได้รับสิ่งใดที่เทมเพลตตั้งไว้ EVENTHUB_NAMESPACE และ EVENTHUB_NAME เป็นตัวแปรที่ฉบับร่างไม่ได้ส่งมอบ ซึ่งบรรทัด warn และความคิดเห็นระบุชื่อไว้ เนมสเปซชื่อ ehmodule ซึ่งเป็นชื่อของส่วนประกอบ ขณะที่เทมเพลตตั้งชื่อว่า evh-notes โดย name ของโมดูลเป็นสิ่งที่ Recipe กำหนด และความคิดเห็นเหนือรายการระบุชื่อนั้นไว้ในพารามิเตอร์ที่ฉบับร่างไม่แปล

ปรับใช้เทมเพลต

เทมเพลตนี้เป็นเทมเพลตระดับกลุ่มทรัพยากร บิลด์ไม่เขียนไฟล์พารามิเตอร์และไม่รันสิ่งใดกับ Azure เลย: คำสั่งเป็นของคุณ ดูตัวอย่างสิ่งที่เทมเพลตจะเปลี่ยนก่อน แล้วปรับใช้:

Terminal window
az deployment group what-if --resource-group <group> --template-file dist/arm/arm-template.json
az deployment group create --resource-group <group> --name <name> --template-file dist/arm/arm-template.json

หน้า ARM Provider อธิบายคำสั่งเหล่านี้ สแตกที่ไม่ลบสิ่งที่หยุดจัดการเลย และสิ่งที่แต่ละแฟล็กกำหนด ก่อนที่เทมเพลตจะปรับใช้ ทรัพยากรที่ Release ระบุชื่อแต่เทมเพลตไม่ได้ปรับใช้ต้องมีอยู่แล้ว ได้แก่ แผน App Service และซับเน็ตที่ไซต์เข้าร่วม ซึ่งมอบหมายให้ Microsoft.Web/serverFarms

กับผู้ช่วย AI

ผู้ช่วย AI ที่ ตั้งค่าด้วยเครื่องมือของ Aggrega ทำสิ่งเดียวกันได้: วางพรอมต์นี้ลงไป

ใช้เครื่องมือของ Aggrega เท่านั้น และอย่าสร้างโฟลเดอร์เอง ถ้าโฟลเดอร์พื้นที่ทำงานยังไม่มีโฟลเดอร์ `import-arm` เรียกเครื่องมือ `draft` หนึ่งครั้งโดยตั้ง `example` เป็น `import-arm` และไม่ระบุ `dir`: เครื่องมือนี้เขียนตัวอย่างลงในโฟลเดอร์ `import-arm` ใหม่ จากนั้นเรียกเครื่องมือ `import` โดยตั้ง `workspace_root` เป็น `import-arm/source` และ `source` เป็น `notes`: เครื่องมือนี้เขียนฉบับร่างลงใน `import-arm/source` และ pull สิ่งที่ฉบับร่างต้องใช้ จากนั้นเรียกเครื่องมือ `build` โดยตั้ง `workspace_root` เป็น `import-arm/reviewed`, `release` เป็น `release.yaml`, `auto_pull` เป็น true และ `write` เป็น true บอกฉันว่าบิลด์เขียนไฟล์ใดบ้าง ไฟล์เหล่านั้นอยู่ใต้ `import-arm/reviewed/dist/`

โฟลเดอร์ reviewed เก็บฉบับร่างที่เขียนค่าไว้แล้ว ตามที่ตรวจสอบความถูกต้องระบุไว้ หากต้องการตรวจทานฉบับร่างของคุณเอง ขอให้ผู้ช่วยตรวจสอบความถูกต้องของ import-arm/source ก่อน และบอกว่าหยุดที่ใด

เปิดใน VS Code

เมื่อติดตั้ง ส่วนขยาย Aggrega สำหรับ Visual Studio Code แล้ว เปิดโฟลเดอร์ import-arm/source ใน VS Code ซึ่งการนำเข้าเขียนฉบับร่างไว้ โฟลเดอร์นี้มี Release หนึ่งรายการ คือ release.yaml ที่ร่างขึ้น ตัวแก้ไขจึงเลือกให้คุณ และตรวจสอบฉบับร่างกับ Release นั้นขณะที่คุณแก้ไข โดยทำเครื่องหมายสิ่งที่พบในไฟล์และในแผง Problems Aggrega: Show topology graph ใน Command Palette วาดส่วนประกอบของ Release และการเชื่อมต่อระหว่างส่วนประกอบเหล่านั้น Aggrega: Build, Aggrega: Preview build และ Aggrega: Pull ทำงานกับ Release เดียวกัน และแต่ละคำสั่งยังเป็นปุ่มบนแผง Commands ของมุมมอง Aggrega ในแถบกิจกรรม Build เขียนไฟล์ลงใน dist/ ของโฟลเดอร์ การใช้ Aggrega ใน Visual Studio Code ครอบคลุมส่วนที่เหลือ

เมื่อเทมเพลตเปลี่ยน

เก็บ .aggrega-import.json ไว้ข้างฉบับร่าง และหลังจากเทมเพลตเปลี่ยน รัน:

Terminal window
aggrega import notes --sync

อ่านเป้าหมายที่บันทึกเก็บไว้ คือ arm และเปลี่ยนเฉพาะสิ่งที่การนำเข้าเขียนไว้ หลังจาก outputLocation ของเว็บแอปแบบสถิตเปลี่ยนจาก dist เป็น build ใน main.json การนำเข้าจะแสดงว่า:

changed spec.components.notes-site.infra.overrides.outputLocation in release.yaml

และเขียน release.yaml โดยเปลี่ยนเพียงบรรทัดนั้นบรรทัดเดียว ค่าที่คุณเขียนไว้ข้างกันยังคงเดิม ส่วนที่ซอร์สไม่ได้แตะต้องยังคงอยู่ตามเดิมบนดิสก์ ไม่ว่าจะแก้ไขแล้วหรือไม่ ส่วนที่ซอร์สเปลี่ยนในจุดที่คุณแก้ไขจะทำให้หยุด ระบุชื่อส่วนนั้น และไม่เขียนอะไรเลย เพื่อให้คุณปรับให้ตรงกันด้วยตนเอง aggrega import อธิบายกฎและแฟล็กทุกตัวโดยละเอียด

เทมเพลตปรับใช้เทมเพลตอื่นได้ผ่านทรัพยากร Microsoft.Resources/deployments ที่ templateLink.relativePath ระบุไฟล์ที่อยู่ข้างกัน การนำเข้าอ่านเทมเพลตที่ลิงก์ภายในไดเรกทอรีที่นำเข้า โดยเริ่มจากเทมเพลตเดียว คือรูท อ่านทุกเทมเพลตที่รูทลิงก์ และร่างทรัพยากรของทั้งหมดเป็น Aggregate เดียว

ไดเรกทอรีที่มีหลายเทมเพลตระบุรูทจากความสัมพันธ์ว่าเทมเพลตใดลิงก์ไปยังเทมเพลตใด โดยรูทคือเทมเพลตเดียวที่ไม่มีเทมเพลตอื่นลิงก์มา ไดเรกทอรีที่มีสองเทมเพลตซึ่งไม่มีลิงก์ระหว่างกันไม่มีรูทเดียว และการนำเข้าจะหยุดและระบุชื่อทั้งสอง:

halt: the sources network.json, site.json are each linked by no other source, and the root setting names none of them: set root to the path of the one to start from

การตั้งค่า root ระบุเทมเพลตที่ใช้เริ่มต้น ในรายการของตัวนำเข้าภายในการกำหนดค่าพื้นที่ทำงาน ส่วน uri ระบุตัวนำเข้าด้วยตัวตนและเวอร์ชันของคอมไพเลอร์ที่คุณรัน ตามที่ aggrega plugin add importer เขียนไว้ (ตัวนำเข้าใดแปลงซอร์สเป็นฉบับร่าง):

plugins:
importer:
- uri: importer/arm:<version>
with:
settings:
root: site.json

เมื่อตั้ง root การนำเข้าจะอ่าน site.json และเทมเพลตที่ลิงก์ และละ network.json ออก

ลิงก์ที่ออกนอกไดเรกทอรีที่นำเข้า — ../shared/dns.json — จะไม่ถูกอ่าน: การนำเข้าไม่เปิดไฟล์นอกไดเรกทอรีที่ได้รับเลย การนำเข้าจะแจ้งคำเตือน โดยระบุชื่อทรัพยากรและเส้นทาง และร่างทรัพยากรนั้นเป็นทรัพยากรของตัวเอง โดยบรรจุเอาต์พุตแต่ละรายการของเทมเพลตนั้นที่เทมเพลตอ่าน ในรูปนิพจน์ที่ประเมินค่าเมื่อเทมเพลตปรับใช้:

warn: dns is a Microsoft.Resources/deployments resource of main.json whose template is linked by a relative path leaving the imported directory, which the import does not read: no resource of that template is drafted, and each of its outputs the template reads is carried as text evaluated when the template deploys; to draft its resources, place the linked template inside the imported directory and link it by templateLink.relativePath

วางเทมเพลตที่ลิงก์ไว้ภายในไดเรกทอรีที่นำเข้า การนำเข้าครั้งถัดไปจะอ่านเทมเพลตนั้น

เมื่อชื่อถูกใช้แล้ว

ทรัพยากรที่ฉบับร่างทำให้เป็น Component จะใช้ชื่อที่การนำเข้าเลือกให้จากชนิดของทรัพยากรนั้น: imported/compute/microsoft-web-staticsites สำหรับเว็บแอปแบบสถิต ถ้ามี Component ชื่อนั้นอยู่แล้วในโฟลเดอร์แค็ตตาล็อกของพื้นที่ทำงานหรือใน hub และการนำเข้านี้ไม่ได้ร่างไว้ การนำเข้าจะไม่เขียนทับและไม่เดา การนำเข้าจะระงับทรัพยากรนั้นไว้ โดยไม่ร่างและไม่อ้างอิงถึง และแจ้งคำเตือน การนำเข้าตัวอย่างครั้งที่สองไปยังโฟลเดอร์อื่นของพื้นที่ทำงานเดียวกันด้วย --output-dir second หลังจากการนำเข้าครั้งแรกเขียน Component ลงในโฟลเดอร์ catalog ของพื้นที่ทำงานแล้ว จะแสดงว่า:

warn: notes-site (Microsoft.Web/staticSites) is held back: the catalog holds the Component imported/compute/microsoft-web-staticsites a draft of it takes, which this import did not draft, so the resource is neither drafted nor referenced; to reference it, write in the importer's settings the entry {"mapping_overrides":{"arm":{"Microsoft.Web/staticSites":{"component":"imported/compute/microsoft-web-staticsites","category":"compute","traits":{"component.aggrega.ai/hosting":"managed","component.aggrega.ai/type":"resource"},"vendor":"staticsites"}}}}, then fill the instance's infra in the Release

การตั้งค่า mapping_overrides ของรายการตัวนำเข้า ซึ่งจัดคีย์ตามรูปแบบ arm แล้วตามชนิดของทรัพยากร แมปชนิดนั้นไปยัง Component ที่มีอยู่ และรายการที่คำเตือนพิมพ์ออกมาคือรายการที่ต้องเขียน (การตั้งค่า) เมื่อใช้การตั้งค่านี้ การนำเข้าครั้งถัดไปจะอ้างอิง Component: notes-site ถูกแมปเป็นการอ้างอิง และรายการของ Component นั้นใน Release ไม่มีคีย์ใดเลยนอกจากความคิดเห็นที่ระบุชื่อคุณสมบัติที่เทมเพลตเขียน:

notes-site: {}

Component ประกาศ name และ location เป็นค่าที่จำเป็น และฉบับร่างไม่เขียนทั้งสองอย่าง การนำเข้าจึงจบโดยรายงานว่าแต่ละรายการขาดหายไป พร้อมกับเขียนฉบับร่างไว้แล้ว เขียนทั้งสอง และคุณสมบัติที่ความคิดเห็นระบุไว้ ลงใน Release ตามที่ Component ประกาศ

สิ่งที่ฉบับร่างทิ้งไว้ให้คุณ

การนำเข้าร่างสิ่งที่เทมเพลตระบุและสิ่งที่แค็ตตาล็อกของคุณกำหนด และแจ้งว่าหยุดที่ใด สำหรับเทมเพลตหนึ่ง การนำเข้าจะทิ้งสิ่งต่อไปนี้ไว้:

  • ชั้นรองรับที่เทมเพลตสร้างเพื่อให้บริการสิ่งอื่น เครือข่ายเสมือน vnet-notes และซับเน็ตของเครือข่ายมีอยู่ในเทมเพลตเพื่อไซต์ ฉบับร่างไม่สร้างเครือข่าย: Component ของแค็ตตาล็อกรับเครือข่ายที่ทำงานอยู่ผ่าน id ของทรัพยากร ภายใต้ infra.overrides และเครือข่ายเป็นของคุณ บรรทัด warn ระบุชื่อทรัพยากรแต่ละรายการเช่นนี้ และตัวชี้ที่อ้างถึงทรัพยากรนั้นคือคีย์ว่างของ Release ในตำแหน่งที่ Release ปรับใช้ เครือข่ายและซับเน็ตมีอยู่แล้ว หรือคุณปรับใช้ด้วยเทมเพลตที่คุณนำเข้า
  • ค่าที่ฉบับร่างไม่ได้วาง ความคิดเห็นของแต่ละรายการ Release ระบุพารามิเตอร์ของโมดูลและคุณสมบัติของทรัพยากรที่ฉบับร่างไม่ได้วาง ซึ่งในที่นี้ได้แก่ระดับ หน่วยปริมาณงาน ภูมิภาค และชื่อของเนมสเปซ รวมถึง kind และ linuxFxVersion ของไซต์ เพื่อให้การตั้งค่าของเทมเพลตถูกระบุไว้ ไม่ถูกละทิ้งอย่างเงียบๆ ในกรณีที่ Component มีที่สำหรับค่าใดค่าหนึ่ง คุณเขียนค่านั้น ดังที่ส่วนตรวจสอบความถูกต้องทำ
  • ตัวแปรสภาพแวดล้อมที่ไม่มีการเชื่อมต่อใดส่งมอบ EVENTHUB_NAMESPACE และ EVENTHUB_NAME ของไซต์ถูกระบุชื่อไว้ในความคิดเห็นของ Aggregate และของ Release และในบรรทัด warn อย่างละหนึ่งบรรทัด ในกรณีที่กำหนดค่าไซต์ใน Release คุณตั้งค่าตัวแปรเหล่านั้น
  • อิมเมจคอนเทนเนอร์ ฉบับร่างบรรจุอิมเมจเฉพาะเมื่อเทมเพลตระบุอิมเมจในคุณสมบัติที่ฉบับร่างวางไว้ เทมเพลตนี้เขียนอิมเมจไว้ใน linuxFxVersion ฉบับร่างจึงไม่บรรจุอิมเมจใดเลย และบิลด์จะหยุดโดยระบุ infra.image: คุณต้องจัดหาอิมเมจใน Release

โมดูลที่ไลบรารีมาตรฐานไม่แมปสิ่งใดให้จะถูกเก็บไว้ครบทั้งโมดูล ในกรณีที่เทมเพลตปรับใช้โมดูล Azure Verified Modules ของชนิดทรัพยากรที่ไม่มีแถวใดของตัวนำเข้าแมปไว้ การนำเข้าจะร่าง Component และ Recipe ที่ใช้โมดูลเป็นซอร์สจาก oci://mcr.microsoft.com/bicep/<path> โดยปิดเทเลเมทรี และพารามิเตอร์ของโมดูลที่รับค่าจากข้อมูลลับจะละออกพร้อมคำเตือน ทรัพยากรชนิดที่ไม่มีแถวใดแมปไว้จะถูกร่างจากเทมเพลตเช่นเดียวกับเว็บแอปแบบสถิต ส่วนคำใบ้การสลับของฉบับร่างระบุ aggrega import --format arm-schema ซึ่งร่าง Component เดียวกันจากสคีมาของผู้จำหน่ายแทน ตามที่ ปรับใช้บริการที่แค็ตตาล็อกไม่มี อธิบายไว้

สตริงที่เขียนข้ามหลายบรรทัด

JSON ไม่รับการขึ้นบรรทัดใหม่แบบดิบภายในสตริง และตัวนำเข้าอ่านเทมเพลตเป็น JSON เทมเพลตที่มีการขึ้นบรรทัดใหม่ดังกล่าว — สคริปต์ที่เขียนข้ามหลายบรรทัดในค่า scriptContent — จะไม่ถูกรู้จัก เพราะการอ่านล้มเหลว:

[E0350]
no importer recognises the source (source "main.json"). Pass --format to name it explicitly (for example --format agent-framework, --format arm-schema, --format arm, --format cloudformation-schema, --format compose, --format crewai, --format dify, --format flowise, --format google-adk, --format langflow, --format langgraph, --format mcp, --format n8n or --format terraform-schema)

และเมื่อใช้ --format arm การนำเข้าจะหยุดโดยระบุตำแหน่ง:

halt: could not parse source "main.json" as arm: json parse: invalid character '\n' in string literal at line 14, column 35

เขียนแต่ละสตริงในบรรทัดเดียว โดยใช้ \n ตรงที่ข้อความขึ้นบรรทัดใหม่ และการนำเข้าจะอ่านได้