# markjbrown/cosmos-aks-samples architecture

> Architecture diagram of the GitHub repository markjbrown/cosmos-aks-samples, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/markjbrown/cosmos-aks-samples
- Repository: https://github.com/markjbrown/cosmos-aks-samples

## Overview

##### Bicep Deployment Path
- Azure Kubernetes Service (AKS)
- Azure Container Registry (ACR)
- Key Vault (for secrets)
- Cosmos DB
- Virtual Network
- Log Analytics Workspace
- Managed Identity

##### ASO Deployment Path
- Azure Kubernetes Service (AKS)
- Azure Container Registry (ACR)
- Azure Service Operator
- Cosmos DB
- Virtual Network
- Managed Identity

##### Component Relationships

- Application → Cosmos DB (data access)
- AKS → ACR (container image pulling)
- Managed Identity → Various Services (authentication)
- ASO → Azure Resources (provisioning)

- Bicep/ASO → Infrastructure Resources
- Key Vault → Application (secrets)

##### Additional Elements

- A network boundary showing the VNet
- Authentication flows with Managed Identity
- RBAC connections to Cosmos DB
- Logging flows to Log Analytics

##### Deployment Paths

- Bicep deployment path
- ASO deployment path

##### Data Storage (Bottom)

Remember to:
- Both deployment options but clearly separated
- Security aspects (Managed Identity, RBAC)
- Containerization aspect with Docker/AKS

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Application Layer"
        AppMVC["ASP.NET Core MVC App"]
        Controllers["Controllers"]:::controller
        Models["Models"]:::model
        Views["Views"]:::view
        Services["Services"]:::service
        
        AppMVC --> Controllers
        AppMVC --> Models
        AppMVC --> Views
        AppMVC --> Services
    end

    subgraph "Bicep Deployment Path"
        BicepMain["Bicep Main"]:::bicep
        AKS_Bicep["Azure Kubernetes Service"]:::azure
        ACR_Bicep["Azure Container Registry"]:::azure
        KeyVault["Key Vault"]:::security
        CosmosDB_Bicep["Cosmos DB"]:::database
        VNet_Bicep["Virtual Network"]:::network
        LogAnalytics["Log Analytics"]:::monitoring
        ManagedId_Bicep["Managed Identity"]:::security
        RBAC_Bicep["RBAC Roles"]:::security
        
        BicepMain --> AKS_Bicep
        BicepMain --> ACR_Bicep
        BicepMain --> KeyVault
        BicepMain --> CosmosDB_Bicep
        BicepMain --> VNet_Bicep
        BicepMain --> LogAnalytics
        BicepMain --> ManagedId_Bicep
        BicepMain --> RBAC_Bicep
    end

    subgraph "ASO Deployment Path"
        ASOMain["ASO Main"]:::aso
        AKS_ASO["Azure Kubernetes Service"]:::azure
        ACR_ASO["Azure Container Registry"]:::azure
        CosmosDB_ASO["Cosmos DB"]:::database
        VNet_ASO["Virtual Network"]:::network
        ManagedId_ASO["Managed Identity"]:::security
        RBAC_ASO["RBAC Roles"]:::security
        
        ASOMain --> AKS_ASO
        ASOMain --> ACR_ASO
        ASOMain --> CosmosDB_ASO
        ASOMain --> VNet_ASO
        ASOMain --> ManagedId_ASO
        ASOMain --> RBAC_ASO
    end

    Services --> CosmosDB_Bicep
    Services --> CosmosDB_ASO
    
    classDef controller fill:#3498db
    classDef model fill:#2ecc71
    classDef view fill:#e74c3c
    classDef service fill:#9b59b6
    classDef azure fill:#00a1f1
    classDef security fill:#f1c40f
    classDef database fill:#8e44ad
    classDef network fill:#e67e22
    classDef monitoring fill:#95a5a6
    classDef bicep fill:#d35400
    classDef aso fill:#c0392b

    click Controllers "https://github.com/markjbrown/cosmos-aks-samples/blob/main/Application/Controllers/ItemController.cs"
    click Models "https://github.com/markjbrown/cosmos-aks-samples/tree/main/Application/Models"
    click Views "https://github.com/markjbrown/cosmos-aks-samples/tree/main/Application/Views/Item"
    click Services "https://github.com/markjbrown/cosmos-aks-samples/tree/main/Application/Services"
    click BicepMain "https://github.com/markjbrown/cosmos-aks-samples/blob/main/Bicep/main.bicep"
    click ASOMain "https://github.com/markjbrown/cosmos-aks-samples/blob/main/ASO/main.bicep"
    click AKS_Bicep "https://github.com/markjbrown/cosmos-aks-samples/blob/main/Bicep/modules/aks/aks.bicep"
    click ACR_Bicep "https://github.com/markjbrown/cosmos-aks-samples/blob/main/Bicep/modules/acr/acr.bicep"
    click KeyVault "https://github.com/markjbrown/cosmos-aks-samples/blob/main/Bicep/modules/keyvault/keyvault.bicep"
    click CosmosDB_Bicep "https://github.com/markjbrown/cosmos-aks-samples/blob/main/Bicep/modules/cosmos/cosmos.bicep"
    click VNet_Bicep "https://github.com/markjbrown/cosmos-aks-samples/blob/main/Bicep/modules/vnet/vnet.bicep"
    click LogAnalytics "https://github.com/markjbrown/cosmos-aks-samples/blob/main/Bicep/modules/laworkspace/la.bicep"
    click ManagedId_Bicep "https://github.com/markjbrown/cosmos-aks-samples/blob/main/Bicep/modules/Identity/userassigned.bicep"
    click RBAC_Bicep "https://github.com/markjbrown/cosmos-aks-samples/blob/main/Bicep/modules/Identity/role.bicep"
    click AKS_ASO "https://github.com/markjbrown/cosmos-aks-samples/blob/main/ASO/modules/aks/aks.bicep"
    click ACR_ASO "https://github.com/markjbrown/cosmos-aks-samples/blob/main/ASO/modules/acr/acr.bicep"
    click VNet_ASO "https://github.com/markjbrown/cosmos-aks-samples/blob/main/ASO/modules/vnet/vnet.bicep"
    click ManagedId_ASO "https://github.com/markjbrown/cosmos-aks-samples/blob/main/ASO/modules/Identity/userassigned.bicep"
    click RBAC_ASO "https://github.com/markjbrown/cosmos-aks-samples/blob/main/ASO/modules/Identity/role.bicep"
```
