How shailender-youtube/architecture_diagrams_python_ai works
Purpose
This repository demonstrates generating Azure architecture diagrams from two sources: infrastructure-as-code examples and an existing Azure environment. Python scripts produce Graphviz/DOT and Draw.io artifacts for visualization.
Entry Points
• Arch_Diagrams/bicep_iis_sql_diagram.py: generates a diagram for the Bicep IIS/SQL three-tier deployment.
• Arch_Diagrams/contoso_architecture.py: generates a predefined Contoso Azure architecture diagram.
• Import_Azure/azure_export.py: imports/export-discovers Azure environment resources.
• Import_Azure/generate_network_flow_diagram.py: transforms discovered Azure networking data into a flow diagram.
• IaC deployment entry points are bicep-demo/demos/iis-2vm-sql-1vm/main.bicep and terraform-demo/main.tf.
Diagram Generation Pipeline
The architecture-diagram layer is Python-based, with dependencies declared in Arch_Diagrams/requirements.txt. Diagram scripts define nodes and relationships representing Azure services, then emit versionable DOT and editable Draw.io outputs:
• Arch_Diagrams/diagrams/bicep_iis_sql_3tier.dot
• Arch_Diagrams/diagrams/bicep_iis_sql_3tier.drawio
• Arch_Diagrams/diagrams/contoso_architecture.dot
• Arch_Diagrams/diagrams/contoso_architecture.drawio
The DOT files are the graph-oriented interchange boundary; Draw.io files are the human-editable visualization boundary.
Bicep Three-Tier Reference Architecture
The main concrete workload is an IIS/SQL topology represented by:
• bicep-demo/demos/iis-2vm-sql-1vm/main.bicep
• bicep-demo/demos/iis-2vm-sql-1vm/azuredeploy.json
• Arch_Diagrams/bicep_iis_sql_diagram.py
Bicep is the source-of-truth declarative model; the generated ARM template (azuredeploy.json) is its deployment-compatible representation. The associated diagram describes the intended deployment architecture rather than runtime-discovered state.
Deployment Assets and Runtime Configuration
The IIS workload includes VM configuration content under:
• bicep-demo/demos/iis-2vm-sql-1vm/scripts/WebServerConfig.zip
• bicep-demo/demos/iis-2vm-sql-1vm/images
• bicep-demo/demos/iis-2vm-sql-1vm/azuredeploy.parameters.json
Azure is the material runtime and infrastructure target. The demo provisions two IIS web-server VMs and one SQL VM, making compute, networking, IIS, and SQL Server central external/runtime concerns.
Existing-Environment Import Flow
The import path addresses already-deployed Azure environments:
• Import_Azure/azure_export.py
• Import_Azure/generate_network_flow_diagram.py
• Import_Azure/INSTRUCTIONS.md
Control flow is Azure subscription/resource discovery → exported resource/network representation → generated network-flow diagram. This path is distinct from Bicep parsing/deployment: it derives diagrams from observed Azure state and likely requires Azure credentials/subscription access.
Alternative IaC Inputs
The repository also includes a Terraform example:
• terraform-demo/main.tf
A blank Bicep starter separates reusable template scaffolding from the IIS/SQL scenario:
• bicep-demo/100-blank-template/main.bicep
• bicep-demo/100-blank-template/azuredeploy.json
These examples establish IaC as an upstream architecture specification, while the Python diagram and Azure-import workflows are visualization-oriented consumers.
Main entry points: main.bicep IIS/SQL Bicep deployment · bicep_iis_sql_diagram.py IIS/SQL diagram generator · contoso_architecture.py Contoso diagram generator · azure_export.py Azure resource discovery
Components 17
IaC specifications
Deployment models and reusable scaffolding.
- IIS/SQL Bicep deployment · Source-of-truth three-tier deployment model.
bicep-demo/demos/iis-2vm-sql-1vm/main.bicep - IIS/SQL ARM template · Deployment-compatible generated representation.
bicep-demo/demos/iis-2vm-sql-1vm/azuredeploy.json - Deployment parameters
bicep-demo/demos/iis-2vm-sql-1vm/azuredeploy.parameters.json - IIS VM configuration · Web-server configuration package and images.
bicep-demo/demos/iis-2vm-sql-1vm/scripts/WebServerConfig.zip - Terraform example · Alternative upstream infrastructure specification.
terraform-demo/main.tf - Blank Bicep starter · Reusable template starting point.
bicep-demo/100-blank-template/main.bicep
Diagram generation
Python produces graph and editable diagram artifacts.
- Diagram dependencies
Arch_Diagrams/requirements.txt - IIS/SQL diagram generator · Models the intended three-tier topology.
Arch_Diagrams/bicep_iis_sql_diagram.py - Contoso diagram generator · Generates a predefined Azure architecture.
Arch_Diagrams/contoso_architecture.py - DOT diagrams · Versionable graph-oriented interchange boundary.
Arch_Diagrams/diagrams/bicep_iis_sql_3tier.dot - Draw.io diagrams · Human-editable visualization boundary.
Arch_Diagrams/diagrams/bicep_iis_sql_3tier.drawio
Azure environment import
Observed-state discovery and network visualization.
- Azure resource discovery · Discovers and exports subscription resources.
Import_Azure/azure_export.py - Network-flow generator · Transforms exported network data into a flow diagram.
Import_Azure/generate_network_flow_diagram.py - Import instructions · Documents environment-import usage and access needs.
Import_Azure/INSTRUCTIONS.md
Other components
- Azure runtime · Deployment target and source of observed state.
- Two IIS web VMs
- SQL Server VM
Connections 19
- IIS/SQL Bicep deployment → IIS/SQL ARM template: compiled to
- Deployment parameters → IIS/SQL ARM template: parameterizes
- IIS VM configuration → Two IIS web VMs: configures
- IIS/SQL Bicep deployment → Azure runtime: deploys to
- Azure runtime → Two IIS web VMs: hosts
- Azure runtime → SQL Server VM: hosts
- Two IIS web VMs → SQL Server VM: uses
- IIS/SQL Bicep deployment → IIS/SQL diagram generator: architecture represented by
- Diagram dependencies → IIS/SQL diagram generator: dependencies for
- Diagram dependencies → Contoso diagram generator: dependencies for
- IIS/SQL diagram generator → DOT diagrams: emits
- IIS/SQL diagram generator → Draw.io diagrams: emits
- Contoso diagram generator → DOT diagrams: emits Contoso variant
- Contoso diagram generator → Draw.io diagrams: emits Contoso variant
- Azure runtime → Azure resource discovery: discovered from
- Azure resource discovery → Network-flow generator: exports resource and network data
- Import instructions → Azure resource discovery: documents
- Terraform example → Azure runtime: alternative deployment input
- Blank Bicep starter → IIS/SQL Bicep deployment: scaffolding alternative