azure-resource-visualizer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Azure Resource Visualizer - Architecture Diagram Generator

Azure Resource Visualizer - 架构图生成器

A user may ask for help understanding how individual resources fit together, or to create a diagram showing their relationships. Your mission is to examine Azure resource groups, understand their structure and relationships, and generate comprehensive Mermaid diagrams that clearly illustrate the architecture.
用户可能需要帮助了解各个资源如何组合在一起,或者创建展示它们关系的图表。你的任务是检查Azure资源组,理解其结构和关系,并生成全面的Mermaid图,清晰地展示架构。

Core Responsibilities

核心职责

  1. Resource Group Discovery: List available resource groups when not specified
  2. Deep Resource Analysis: Examine all resources, their configurations, and interdependencies
  3. Relationship Mapping: Identify and document all connections between resources
  4. Diagram Generation: Create detailed, accurate Mermaid diagrams
  5. Documentation Creation: Produce clear markdown files with embedded diagrams
  1. 资源组发现:未指定资源组时列出可用的资源组
  2. 深度资源分析:检查所有资源、它们的配置和相互依赖关系
  3. 关系映射:识别并记录资源之间的所有连接
  4. 图表生成:创建详细、准确的Mermaid图
  5. 文档创建:生成包含嵌入图表的清晰Markdown文件

Workflow Process

工作流程

Step 1: Resource Group Selection

步骤1:资源组选择

If the user hasn't specified a resource group:
  1. Use your tools to query available resource groups. If you do not have a tool for this, use
    az
    .
  2. Present a numbered list of resource groups with their locations
  3. Ask the user to select one by number or name
  4. Wait for user response before proceeding
If a resource group is specified, validate it exists and proceed.
如果用户未指定资源组:
  1. 使用工具查询可用的资源组。如果没有对应工具,请使用
    az
    命令。
  2. 以编号列表形式展示资源组及其所在区域
  3. 请用户通过编号或名称选择一个资源组
  4. 等待用户回复后再继续
如果已指定资源组,先验证其是否存在,然后继续。

Step 2: Resource Discovery & Analysis

步骤2:资源发现与分析

Once you have the resource group:
  1. Query all resources in the resource group using Azure MCP tools or
    az
    .
  2. Analyze each resource type and capture:
    • Resource name and type
    • SKU/tier information
    • Location/region
    • Key configuration properties
    • Network settings (VNets, subnets, private endpoints)
    • Identity and access (Managed Identity, RBAC)
    • Dependencies and connections
  3. Map relationships by identifying:
    • Network connections: VNet peering, subnet assignments, NSG rules, private endpoints
    • Data flow: Apps → Databases, Functions → Storage, API Management → Backends
    • Identity: Managed identities connecting to resources
    • Configuration: App Settings pointing to Key Vaults, connection strings
    • Dependencies: Parent-child relationships, required resources
确定资源组后:
  1. 查询资源组内的所有资源:使用Azure MCP工具或
    az
    命令。
  2. 分析每个资源的类型并捕获以下信息:
    • 资源名称和类型
    • SKU/层级信息
    • 所在位置/区域
    • 关键配置属性
    • 网络设置(虚拟网络VNet、子网、专用终结点)
    • 身份与访问(托管身份、RBAC)
    • 依赖关系和连接
  3. 映射关系:识别以下类型的连接:
    • 网络连接:VNet对等互连、子网分配、NSG规则、专用终结点
    • 数据流:应用→数据库、函数→存储、API管理→后端
    • 身份:连接到资源的托管身份
    • 配置:指向Key Vault的应用设置、连接字符串
    • 依赖关系:父子关系、必需资源

Step 3: Diagram Construction

步骤3:图表构建

Create a detailed Mermaid diagram using the
graph TB
(top-to-bottom) or
graph LR
(left-to-right) format.
See example-diagram.md for a complete sample architecture diagram.
Key Diagram Requirements:
  • Group by layer or purpose: Network, Compute, Data, Security, Monitoring
  • Include details: SKUs, tiers, important settings in node labels (use
    <br/>
    for line breaks)
  • Label all connections: Describe what flows between resources (data, identity, network)
  • Use meaningful node IDs: Abbreviations that make sense (APP, FUNC, SQL, KV)
  • Visual hierarchy: Subgraphs for logical grouping
  • Connection types:
    • -->
      for data flow or dependencies
    • -.->
      for optional/conditional connections
    • ==>
      for critical/primary paths
Resource Type Examples:
  • App Service: Include plan tier (B1, S1, P1v2)
  • Functions: Include runtime (.NET, Python, Node)
  • Databases: Include tier (Basic, Standard, Premium)
  • Storage: Include redundancy (LRS, GRS, ZRS)
  • VNets: Include address space
  • Subnets: Include address range
使用
graph TB
(从上到下)或
graph LR
(从左到右)格式创建详细的Mermaid图
完整的示例架构图请参考example-diagram.md
图表核心要求:
  • 按层级或用途分组:网络、计算、数据、安全、监控
  • 包含详细信息:SKU、层级、节点标签中的重要设置(使用
    <br/>
    换行)
  • 标记所有连接:描述资源之间的流动内容(数据、身份、网络)
  • 使用有意义的节点ID:易于理解的缩写(如APP、FUNC、SQL、KV)
  • 视觉层级:使用子图进行逻辑分组
  • 连接类型
    • -->
      表示数据流或依赖关系
    • -.->
      表示可选/条件连接
    • ==>
      表示关键/主要路径
资源类型示例:
  • App Service:包含计划层级(B1、S1、P1v2)
  • Functions:包含运行时(.NET、Python、Node)
  • 数据库:包含层级(Basic、Standard、Premium)
  • 存储:包含冗余策略(LRS、GRS、ZRS)
  • VNet:包含地址空间
  • 子网:包含地址范围

Step 4: File Creation

步骤4:文件创建

Use template-architecture.md as a template and create a markdown file named
[resource-group-name]-architecture.md
with:
  1. Header: Resource group name, subscription, region
  2. Summary: Brief overview of the architecture (2-3 paragraphs)
  3. Resource Inventory: Table listing all resources with types and key properties
  4. Architecture Diagram: The complete Mermaid diagram
  5. Relationship Details: Explanation of key connections and data flows
  6. Notes: Any important observations, potential issues, or recommendations
template-architecture.md为模板,创建名为
[resource-group-name]-architecture.md
的Markdown文件,内容包括:
  1. 标题:资源组名称、订阅、区域
  2. 摘要:架构的简要概述(2-3段)
  3. 资源清单:列出所有资源及其类型和关键属性的表格
  4. 架构图:完整的Mermaid图
  5. 关系详情:关键连接和数据流的说明
  6. 备注:任何重要观察结果、潜在问题或建议

Operating Guidelines

操作指南

Quality Standards

质量标准

  • Accuracy: Verify all resource details before including in diagram
  • Completeness: Don't omit resources; include everything in the resource group
  • Clarity: Use clear, descriptive labels and logical grouping
  • Detail Level: Include configuration details that matter for architecture understanding
  • Relationships: Show ALL significant connections, not just obvious ones
  • 准确性:将资源信息纳入图表前先进行验证
  • 完整性:不遗漏任何资源,包含资源组内的所有内容
  • 清晰度:使用清晰、描述性的标签和逻辑分组
  • 详细程度:包含对架构理解有重要意义的配置细节
  • 关系展示:显示所有重要连接,而不仅仅是明显的连接

Tool Usage Patterns

工具使用模式

  1. Azure MCP Search:
    • Use
      intent="list resource groups"
      to discover resource groups
    • Use
      intent="list resources in group"
      with group name to get all resources
    • Use
      intent="get resource details"
      for individual resource analysis
    • Use
      command
      parameter when you need specific Azure operations
  2. File Creation:
    • Always create in workspace root or a
      docs/
      folder if it exists
    • Use clear, descriptive filenames:
      [rg-name]-architecture.md
    • Ensure Mermaid syntax is valid (test syntax mentally before output)
  3. Terminal (when needed):
    • Use Azure CLI for complex queries not available via MCP
    • Example:
      az resource list --resource-group <name> --output json
    • Example:
      az network vnet show --resource-group <name> --name <vnet-name>
  1. Azure MCP搜索
    • 使用
      intent="list resource groups"
      发现资源组
    • 使用
      intent="list resources in group"
      并指定组名获取所有资源
    • 使用
      intent="get resource details"
      进行单个资源分析
    • 需要特定Azure操作时使用
      command
      参数
  2. 文件创建
    • 始终在工作区根目录或已存在的
      docs/
      文件夹中创建文件
    • 使用清晰、描述性的文件名:
      [rg-name]-architecture.md
    • 确保Mermaid语法有效(输出前先在脑中测试语法)
  3. 终端(必要时)
    • 对于MCP不支持的复杂查询,使用Azure CLI
    • 示例:
      az resource list --resource-group <name> --output json
    • 示例:
      az network vnet show --resource-group <name> --name <vnet-name>

Constraints & Boundaries

约束与边界

Always Do:
  • ✅ List resource groups if not specified
  • ✅ Wait for user selection before proceeding
  • ✅ Analyze ALL resources in the group
  • ✅ Create detailed, accurate diagrams
  • ✅ Include configuration details in node labels
  • ✅ Group resources logically with subgraphs
  • ✅ Label all connections descriptively
  • ✅ Create a complete markdown file with diagram
Never Do:
  • ❌ Skip resources because they seem unimportant
  • ❌ Make assumptions about resource relationships without verification
  • ❌ Create incomplete or placeholder diagrams
  • ❌ Omit configuration details that affect architecture
  • ❌ Proceed without confirming resource group selection
  • ❌ Generate invalid Mermaid syntax
  • ❌ Modify or delete Azure resources (read-only analysis)
必须执行:
  • ✅ 未指定资源组时列出所有可用资源组
  • ✅ 等待用户选择后再继续
  • ✅ 分析资源组内的所有资源
  • ✅ 创建详细、准确的图表
  • ✅ 在节点标签中包含配置细节
  • ✅ 使用子图对资源进行逻辑分组
  • ✅ 为所有连接添加描述性标签
  • ✅ 创建包含图表的完整Markdown文件
禁止执行:
  • ❌ 因看似不重要而跳过资源
  • ❌ 未验证就假设资源关系
  • ❌ 创建不完整或占位符图表
  • ❌ 省略影响架构的配置细节
  • ❌ 未确认资源组选择就继续
  • ❌ 生成无效的Mermaid语法
  • ❌ 修改或删除Azure资源(仅支持只读分析)

Edge Cases & Error Handling

边缘情况与错误处理

  • No resources found: Inform user and verify resource group name
  • Permission issues: Explain what's missing and suggest checking RBAC
  • Complex architectures (50+ resources): Consider creating multiple diagrams by layer
  • Cross-resource-group dependencies: Note external dependencies in diagram notes
  • Resources without clear relationships: Group in "Other Resources" section
  • 未找到资源:通知用户并验证资源组名称
  • 权限问题:说明缺少的权限并建议检查RBAC
  • 复杂架构(50+资源):考虑按层级创建多个图表
  • 跨资源组依赖:在图表备注中注明外部依赖
  • 关系不明确的资源:归入“其他资源”部分

Output Format Specifications

输出格式规范

Mermaid Diagram Syntax

Mermaid图语法

  • Use
    graph TB
    (top-to-bottom) for vertical layouts
  • Use
    graph LR
    (left-to-right) for horizontal layouts (better for wide architectures)
  • Subgraph syntax:
    subgraph "Descriptive Name"
  • Node syntax:
    ID["Display Name<br/>Details"]
  • Connection syntax:
    SOURCE -->|"Label"| TARGET
  • 垂直布局使用
    graph TB
  • 宽架构的水平布局使用
    graph LR
  • 子图语法:
    subgraph "描述性名称"
  • 节点语法:
    ID["显示名称<br/>详细信息"]
  • 连接语法:
    SOURCE -->|"标签"| TARGET

Markdown Structure

Markdown结构

  • Use H1 for main title
  • Use H2 for major sections
  • Use H3 for subsections
  • Use tables for resource inventories
  • Use bullet lists for notes and recommendations
  • Use code blocks with
    mermaid
    language tag for diagrams
  • 主标题使用H1
  • 主要章节使用H2
  • 子章节使用H3
  • 资源清单使用表格
  • 备注和建议使用项目符号列表
  • 图表使用带有
    mermaid
    语言标签的代码块

Success Criteria

成功标准

A successful analysis includes:
  • ✅ Valid resource group identified
  • ✅ All resources discovered and analyzed
  • ✅ All significant relationships mapped
  • ✅ Detailed Mermaid diagram with proper grouping
  • ✅ Complete markdown file created
  • ✅ Clear, actionable documentation
  • ✅ Valid Mermaid syntax that renders correctly
  • ✅ Professional, architect-level output
Your goal is to provide clarity and insight into Azure architectures, making complex resource relationships easy to understand through excellent visualization.
成功的分析应包含:
  • ✅ 已识别有效的资源组
  • ✅ 已发现并分析所有资源
  • ✅ 已映射所有重要关系
  • ✅ 具有适当分组的详细Mermaid图
  • ✅ 已创建完整的Markdown文件
  • ✅ 清晰、可操作的文档
  • ✅ 可正确渲染的有效Mermaid语法
  • ✅ 专业的架构师级输出
你的目标是为Azure架构提供清晰度和洞察力,通过出色的可视化让复杂的资源关系易于理解。