azure-diagrams
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAzure Diagram Generator
Azure架构图生成器
Generates architecture diagrams for Azure infrastructure from ARM templates, Azure CLI output, or natural language descriptions.
基于ARM模板、Azure CLI输出或自然语言描述生成Azure基础设施的架构图。
When to Use
使用场景
Activate this skill when:
- User has ARM (Azure Resource Manager) templates (JSON)
- User provides Azure CLI output (e.g., )
az vm list - User wants to visualize Azure resources
- User mentions Azure services (Virtual Machines, Storage Accounts, VNets, etc.)
- User asks to "diagram my Azure infrastructure"
在以下场景中激活此技能:
- 用户拥有ARM(Azure资源管理器)模板(JSON格式)
- 用户提供Azure CLI输出(例如:)
az vm list - 用户希望可视化Azure资源
- 用户提及Azure服务(虚拟机、存储账户、虚拟网络等)
- 用户要求“为我的Azure基础设施绘制架构图”
How It Works
工作原理
This skill generates Azure-specific diagrams by parsing Azure resources and calling the Eraser API directly:
- Parse Azure Resources: Extract resources from ARM templates, CLI output, or descriptions
- Map Azure Relationships: Identify Resource Groups, VNets, subnets, and service connections
- Generate Eraser DSL: Create Eraser DSL code from Azure resources
- Call Eraser API: Use with
/api/render/elementsdiagramType: "cloud-architecture-diagram"
此技能通过解析Azure资源并直接调用Eraser API生成Azure专属架构图:
- 解析Azure资源:从ARM模板、CLI输出或文字描述中提取资源信息
- 映射Azure资源关系:识别资源组、虚拟网络、子网及服务连接关系
- 生成Eraser DSL:将Azure资源转换为Eraser DSL代码
- 调用Eraser API:使用接口,指定
/api/render/elementsdiagramType: "cloud-architecture-diagram"
Instructions
操作指南
When the user provides Azure infrastructure information:
-
Parse the Source
- ARM Templates: Extract array, identify types (Microsoft.Compute/virtualMachines, etc.)
resources - CLI Output: Parse JSON output from commands
az - Description: Identify Azure service names and relationships
- ARM Templates: Extract
-
Identify Azure Components
- Networking: Virtual Networks (VNets), Subnets, Network Security Groups, Load Balancers
- Compute: Virtual Machines, Virtual Machine Scale Sets, App Services, Functions
- Storage: Storage Accounts, Blob Storage, File Shares
- Databases: SQL Databases, Cosmos DB, Redis Cache
- Security: Network Security Groups, Azure AD, Key Vault
- Load Balancing: Application Gateway, Load Balancer, Traffic Manager
- Other: Service Bus, Event Hubs, API Management
-
Map Relationships
- VMs in subnets
- Subnets in VNets
- VNets in Resource Groups
- Storage accounts accessed by VMs
- Databases accessed by applications
- Network Security Groups attached to subnets
-
Generate Eraser DSL Convert Azure resources to Eraser DSL:
- CRITICAL: Label Formatting Rules
- Labels MUST be on a single line - NEVER use newlines inside label attributes
- Keep labels simple and readable - prefer separate labels over concatenating too much metadata
- Format DSL with proper line breaks (one node/group per line, but labels stay on single lines)
- If including metadata like CIDR blocks or instance types, include them in the same quoted label string:
[label: "VNet 10.0.0.0/16"]
Example:myVNet [label: "VNet 10.0.0.0/16"] { subnet1 [label: "Subnet 1"] { myVM [icon: azure-vm, label: "Virtual Machine"] gateway [icon: azure-app-gateway] } subnet2 [label: "Subnet 2"] { database [icon: azure-sql] } } storage [icon: azure-storage] myVNet -> myVM myVM -> database - CRITICAL: Label Formatting Rules
-
Make the HTTP RequestIMPORTANT: You MUST execute this curl command after generating the DSL. Never stop after generating DSL without making the API call.CRITICAL: In theheader below, you MUST replace the value with your AI agent name:
X-Skill-Source- If you are Claude (Anthropic), use:
claude - If you are running in Cursor, use:
cursor - If you are ChatGPT (OpenAI), use:
chatgpt - If you are Gemini (Google), use:
gemini - Otherwise, use your model/agent name in lowercase
bashcurl -X POST https://app.eraser.io/api/render/elements \ -H "Content-Type: application/json" \ -H "X-Skill-Source: eraser-skill" \ -H "Authorization: Bearer ${ERASER_API_KEY}" \ -d '{ "elements": [{ "type": "diagram", "id": "diagram-1", "code": "<your generated DSL>", "diagramType": "cloud-architecture-diagram" }], "scale": 2, "theme": "${ERASER_THEME:-dark}", "background": true }' - If you are Claude (Anthropic), use:
-
Track Sources During AnalysisAs you analyze files and resources to generate the diagram, track:
- Internal files: Record each file path you read and what information was extracted (e.g., - VNet and subnet definitions)
infra/main.bicep - External references: Note any documentation, examples, or URLs consulted (e.g., Azure architecture best practices documentation)
- Annotations: For each source, note what it contributed to the diagram
- Internal files: Record each file path you read and what information was extracted (e.g.,
-
Handle the ResponseCRITICAL: Minimal Output FormatYour response MUST always include these elements with clear headers:
-
Diagram Preview: Display with a header
## Diagram Use the ACTUALfrom the API response.imageUrl -
Editor Link: Display with a header
## Open in Eraser [Edit this diagram in the Eraser editor]({createEraserFileUrl})Use the ACTUAL URL from the API response. -
Sources section: Brief list of files/resources analyzed (if applicable)
## Sources - `path/to/file` - What was extracted -
Diagram Code section: The Eraser DSL in a code block withlanguage tag
eraser## Diagram Code ```eraser {DSL code here}undefined -
Learn More link:
You can learn more about Eraser at https://docs.eraser.io/docs/using-ai-agent-integrations
Additional content rules:- If the user ONLY asked for a diagram, include NOTHING beyond the 5 elements above
- If the user explicitly asked for more (e.g., "explain the architecture", "suggest improvements"), you may include that additional content
- Never add unrequested sections like Overview, Security Considerations, Testing, etc.
The default output should be SHORT. The diagram image speaks for itself. -
当用户提供Azure基础设施信息时:
-
解析数据源
- ARM模板:提取数组,识别资源类型(如Microsoft.Compute/virtualMachines等)
resources - CLI输出:解析命令返回的JSON格式输出
az - 文字描述:识别Azure服务名称及相互关系
- ARM模板:提取
-
识别Azure组件
- 网络类:虚拟网络(VNet)、子网、网络安全组、负载均衡器
- 计算类:虚拟机、虚拟机规模集、应用服务、函数服务
- 存储类:存储账户、Blob存储、文件共享
- 数据库类:SQL数据库、Cosmos DB、Redis缓存
- 安全类:网络安全组、Azure AD、密钥保管库
- 负载均衡类:应用网关、负载均衡器、流量管理器
- 其他类:服务总线、事件中心、API管理
-
映射资源关系
- 虚拟机归属子网
- 子网归属虚拟网络
- 虚拟网络归属资源组
- 虚拟机访问存储账户
- 应用程序访问数据库
- 子网关联网络安全组
-
生成Eraser DSL:将Azure资源转换为Eraser DSL代码:
- 关键:标签格式规则
- 标签必须单行显示 - 标签属性内绝对不能使用换行符
- 标签需简洁易读 - 优先使用独立标签,避免拼接过多元数据
- DSL代码需格式规范(每个节点/组单独一行,但标签保持单行)
- 若需包含CIDR块或实例类型等元数据,需放在同一个带引号的标签字符串中:
[label: "VNet 10.0.0.0/16"]
示例:myVNet [label: "VNet 10.0.0.0/16"] { subnet1 [label: "Subnet 1"] { myVM [icon: azure-vm, label: "Virtual Machine"] gateway [icon: azure-app-gateway] } subnet2 [label: "Subnet 2"] { database [icon: azure-sql] } } storage [icon: azure-storage] myVNet -> myVM myVM -> database - 关键:标签格式规则
-
发起HTTP请求重要提示:生成DSL后必须执行以下curl命令,绝对不能在生成DSL后停止操作而不调用API。关键要求:在下方的请求头中,必须将值替换为你的AI Agent名称:
X-Skill-Source- 若你是Claude(Anthropic),使用:
claude - 若你在Cursor中运行,使用:
cursor - 若你是ChatGPT(OpenAI),使用:
chatgpt - 若你是Gemini(Google),使用:
gemini - 其他情况,使用你的模型/Agent的小写名称
bashcurl -X POST https://app.eraser.io/api/render/elements \ -H "Content-Type: application/json" \ -H "X-Skill-Source: eraser-skill" \ -H "Authorization: Bearer ${ERASER_API_KEY}" \ -d '{ "elements": [{ "type": "diagram", "id": "diagram-1", "code": "<your generated DSL>", "diagramType": "cloud-architecture-diagram" }], "scale": 2, "theme": "${ERASER_THEME:-dark}", "background": true }' - 若你是Claude(Anthropic),使用:
-
分析过程中追踪数据源在分析文件和资源以生成架构图时,需追踪以下信息:
- 内部文件:记录读取的每个文件路径及提取的信息(例如:- 虚拟网络和子网定义)
infra/main.bicep - 外部参考:记录查阅的文档、示例或URL(例如:Azure架构最佳实践文档)
- 注释:为每个数据源标注其对架构图的贡献内容
- 内部文件:记录读取的每个文件路径及提取的信息(例如:
-
处理API响应关键:最小输出格式你的响应必须始终包含以下元素及清晰的标题:
-
架构图预览:带标题显示
## 架构图 使用API响应中的实际。imageUrl -
编辑器链接:带标题显示
## 在Eraser中打开 [在Eraser编辑器中编辑此架构图]({createEraserFileUrl})使用API响应中的实际URL。 -
数据源部分:简要列出分析的文件/资源(如有)
## 数据源 - `path/to/file` - 提取的信息内容 -
架构图代码部分:将Eraser DSL放在带有语言标签的代码块中
eraser## 架构图代码 ```eraser {DSL code here}undefined -
了解更多链接:
你可以访问https://docs.eraser.io/docs/using-ai-agent-integrations了解更多关于Eraser的信息
额外内容规则:- 若用户仅要求生成架构图,除上述5项内容外不得添加任何其他内容
- 若用户明确要求更多内容(例如:“解释架构”、“提出优化建议”),可添加相关内容
- 绝对不能添加未被要求的章节,如概述、安全注意事项、测试等
默认输出应简洁。架构图本身即可说明问题。 -
Azure-Specific Tips
Azure专属提示
- Resource Groups: Show Resource Groups as logical containers
- VNets as Containers: Always show VNets containing subnets and resources
- Network Security Groups: Include NSG rules and attachments
- Subscriptions: Note subscription context if provided
- Data Flow: Show traffic flow (Internet → Application Gateway → VM → SQL Database)
- Use Azure Icons: Request Azure-specific styling in the description
- 资源组:将资源组显示为逻辑容器
- 虚拟网络作为容器:始终将虚拟网络显示为包含子网和资源的容器
- 网络安全组:包含NSG规则及关联关系
- 订阅:若提供了订阅上下文需标注
- 数据流:显示流量流向(互联网 → 应用网关 → 虚拟机 → SQL数据库)
- 使用Azure图标:在描述中要求使用Azure专属样式
Example: ARM Template with Multiple Azure Services
示例:包含多Azure服务的ARM模板
User Input
用户输入
json
{
"resources": [
{
"type": "Microsoft.Resources/resourceGroups",
"name": "rg-main"
},
{
"type": "Microsoft.Network/virtualNetworks",
"name": "myVNet",
"properties": {
"addressSpace": {
"addressPrefixes": ["10.0.0.0/16"]
},
"subnets": [
{
"name": "subnet1",
"properties": {
"addressPrefix": "10.0.1.0/24"
}
}
]
}
},
{
"type": "Microsoft.Compute/virtualMachines",
"name": "myVM",
"properties": {
"hardwareProfile": {
"vmSize": "Standard_B1s"
}
}
},
{
"type": "Microsoft.Web/sites",
"name": "myAppService",
"properties": {
"serverFarmId": "/subscriptions/.../serverfarms/myPlan"
}
},
{
"type": "Microsoft.Storage/storageAccounts",
"name": "mystorageaccount"
},
{
"type": "Microsoft.Sql/servers",
"name": "mysqlserver",
"properties": {
"administratorLogin": "admin"
}
}
]
}json
{
"resources": [
{
"type": "Microsoft.Resources/resourceGroups",
"name": "rg-main"
},
{
"type": "Microsoft.Network/virtualNetworks",
"name": "myVNet",
"properties": {
"addressSpace": {
"addressPrefixes": ["10.0.0.0/16"]
},
"subnets": [
{
"name": "subnet1",
"properties": {
"addressPrefix": "10.0.1.0/24"
}
}
]
}
},
{
"type": "Microsoft.Compute/virtualMachines",
"name": "myVM",
"properties": {
"hardwareProfile": {
"vmSize": "Standard_B1s"
}
}
},
{
"type": "Microsoft.Web/sites",
"name": "myAppService",
"properties": {
"serverFarmId": "/subscriptions/.../serverfarms/myPlan"
}
},
{
"type": "Microsoft.Storage/storageAccounts",
"name": "mystorageaccount"
},
{
"type": "Microsoft.Sql/servers",
"name": "mysqlserver",
"properties": {
"administratorLogin": "admin"
}
}
]
}Expected Behavior
预期操作
-
Parses ARM template:
- Resource Group: rg-main (container)
- Networking: VNet with subnet
- Compute: VM, App Service
- Storage: Storage Account
- Database: SQL Server
-
Generates DSL showing Azure service diversity:
resource-group [label: "Resource Group rg-main"] { myVNet [label: "VNet 10.0.0.0/16"] { subnet1 [label: "Subnet 1 10.0.1.0/24"] { myVM [icon: azure-vm, label: "VM Standard_B1s"] } } myAppService [icon: azure-app-service, label: "App Service"] mystorageaccount [icon: azure-storage, label: "Storage Account"] mysqlserver [icon: azure-sql, label: "SQL Server"] } myAppService -> mystorageaccount myVM -> mysqlserverImportant: All label text must be on a single line within quotes. Azure-specific: Show Resource Groups as containers, include App Services, Storage Accounts, and SQL databases with proper Azure icons. -
Callswith
/api/render/elementsdiagramType: "cloud-architecture-diagram"
-
解析ARM模板:
- 资源组:rg-main(容器)
- 网络类:带子网的虚拟网络
- 计算类:虚拟机、应用服务
- 存储类:存储账户
- 数据库类:SQL服务器
-
生成展示多Azure服务的DSL代码:
resource-group [label: "Resource Group rg-main"] { myVNet [label: "VNet 10.0.0.0/16"] { subnet1 [label: "Subnet 1 10.0.1.0/24"] { myVM [icon: azure-vm, label: "VM Standard_B1s"] } } myAppService [icon: azure-app-service, label: "App Service"] mystorageaccount [icon: azure-storage, label: "Storage Account"] mysqlserver [icon: azure-sql, label: "SQL Server"] } myAppService -> mystorageaccount myVM -> mysqlserver重要提示:所有标签文本必须放在带引号的单行内。Azure专属要求:将资源组显示为容器,使用正确的Azure图标展示应用服务、存储账户和SQL数据库。 -
调用接口,指定
/api/render/elementsdiagramType: "cloud-architecture-diagram"
Example: Azure CLI Output
示例:Azure CLI输出
User Input
用户输入
User runs: az vm list --output json
Provides JSON output用户执行:az vm list --output json
提供JSON格式输出Expected Behavior
预期操作
-
Parses JSON to extract:
- VM names, sizes, states
- Resource groups
- Network interfaces
- Storage accounts
-
Formats and calls API
-
解析JSON提取以下信息:
- 虚拟机名称、规格、状态
- 资源组
- 网络接口
- 存储账户
-
格式化信息并调用API