# azure/iot-identity-service architecture

> Architecture diagram of the GitHub repository azure/iot-identity-service, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/azure/iot-identity-service
- Repository: https://github.com/azure/iot-identity-service

## Overview

##### Project type and purpose
- This is a Rust-based, microservices-style “device runtime” for Azure IoT devices. It provides a CLI (aziotctl) plus four long-running daemons (aziotd, aziot-certd, aziot-identityd, aziot-keyd, aziot-tpmd) that together manage certificates, identities, keys, and TPM operations on the device.

##### File structure
- Top-level crates:
- aziotctl – command-line interface
- aziotd – runtime orchestrator daemon
- cert/{aziot-certd, cert-renewal, cert-common…} – certificate service and libraries
- identity/{aziot-identityd, identity-common…, cloud-client…} – identity service and clients
- key/{aziot-keyd, key-common…, openssl-engine…} – key service and crypto engine
- tpm/{aziot-tpmd, tss-minimal…, tpm-clients} – TPM service and TSS libraries
- http-common, config-common – shared HTTP server/client and config-watcher libraries
- Each daemon has its own config folder (default TOML under unix), an OpenAPI spec (for REST routes), and implements HTTP endpoints for management.
- Common backend crates (http-common, *-common-http, *-client-async) factor out client/server logic and protocol models.

##### README
- Confirms it serves as the Azure IoT Identity Service runtime

## Diagram (Mermaid)

```mermaid
flowchart TD
    CLI["aziotctl"]:::cli

    subgraph "Local Runtime"
        ORC["aziotd"]:::service
        CERT["aziot-certd"]:::service
        ID["aziot-identityd"]:::service
        KEY["aziot-keyd"]:::service
        TPM["aziot-tpmd"]:::service
        D[(Configuration Store)]:::config
    end

    subgraph "Shared Libraries"
        HTTP["http-common"]:::shared
        CFG["config-common"]:::shared
        CERTSH["aziot-cert-common-http"]:::shared
        CERTCL["aziot-cert-client-async"]:::shared
        CERTC["cert-common"]:::shared
        CERTREN["cert-renewal"]:::shared
        IDSH["aziot-identity-common-http"]:::shared
        IDCL["aziot-identity-client-async"]:::shared
        IDCC["aziot-cloud-client-async"]:::shared
        IDC["aziot-identity-common"]:::shared
        KEYSH["aziot-key-common-http"]:::shared
        KEYCL["aziot-key-client-async"]:::shared
        KEYC["aziot-key-common"]:::shared
        KEYENG["aziot-key-openssl-engine"]:::shared
        KEYENGS["aziot-key-openssl-engine-shared"]:::shared
        TPMSH["aziot-tpm-common-http"]:::shared
        TPMCL["aziot-tpm-client-async"]:::shared
        TSS["tss-minimal"]:::shared
    end

    subgraph "Cloud Endpoints"
        DPS["DPS / IoT Hub REST API"]:::cloud
        EST["EST CA Server"]:::cloud
    end

    CLI -->|"HTTP/JSON over UNIX socket"| ORC
    ORC -->|"HTTP/JSON"| CERT
    ORC -->|"HTTP/JSON"| ID
    ORC -->|"HTTP/JSON"| KEY
    ORC -->|"HTTP/JSON"| TPM

    CERT -->|"reads/writes TOML"| D
    ID -->|"reads/writes TOML"| D
    KEY -->|"reads/writes TOML"| D
    TPM -->|"reads/writes TOML"| D

    CERT --> HTTP
    CERT --> CFG
    CERT --> CERTSH
    CERT --> CERTCL
    CERT --> CERTC
    CERT --> CERTREN

    ID --> HTTP
    ID --> CFG
    ID --> IDSH
    ID --> IDCL
    ID --> IDCC
    ID --> IDC

    KEY --> HTTP
    KEY --> CFG
    KEY --> KEYSH
    KEY --> KEYCL
    KEY --> KEYC
    KEY --> KEYENG
    KEY --> KEYENGS

    TPM --> HTTP
    TPM --> CFG
    TPM --> TPMSH
    TPM --> TPMCL
    TPM --> TSS

    CERT -->|"HTTPS"| EST
    ID -->|"HTTPS"| DPS

    classDef cli fill:#F5B041,stroke:#F39C12,color:#000
    classDef service fill:#ABEBC6,stroke:#27AE60,color:#000
    classDef config fill:#D5D8DC,stroke:#7B7D7D,color:#000
    classDef shared fill:#F9E79F,stroke:#F1C40F,color:#000
    classDef cloud fill:#AED6F1,stroke:#3498DB,color:#000

    click CLI "https://github.com/azure/iot-identity-service/tree/main/aziotctl/"
    click ORC "https://github.com/azure/iot-identity-service/tree/main/aziotd/"
    click CERT "https://github.com/azure/iot-identity-service/tree/main/cert/aziot-certd/"
    click ID "https://github.com/azure/iot-identity-service/tree/main/identity/aziot-identityd/"
    click KEY "https://github.com/azure/iot-identity-service/tree/main/key/aziot-keyd/"
    click TPM "https://github.com/azure/iot-identity-service/tree/main/tpm/aziot-tpmd/"
    click HTTP "https://github.com/azure/iot-identity-service/tree/main/http-common/"
    click CFG "https://github.com/azure/iot-identity-service/tree/main/config-common/"
    click CERTSH "https://github.com/azure/iot-identity-service/tree/main/cert/aziot-cert-common-http/"
    click CERTCL "https://github.com/azure/iot-identity-service/tree/main/cert/aziot-cert-client-async/"
    click CERTC "https://github.com/azure/iot-identity-service/tree/main/cert/aziot-cert-common/"
    click CERTREN "https://github.com/azure/iot-identity-service/tree/main/cert/cert-renewal/"
    click IDSH "https://github.com/azure/iot-identity-service/tree/main/identity/aziot-identity-common-http/"
    click IDCL "https://github.com/azure/iot-identity-service/tree/main/identity/aziot-identity-client-async/"
    click IDCC "https://github.com/azure/iot-identity-service/tree/main/identity/aziot-cloud-client-async/"
    click IDC "https://github.com/azure/iot-identity-service/tree/main/identity/aziot-identity-common/"
    click KEYSH "https://github.com/azure/iot-identity-service/tree/main/key/aziot-key-common-http/"
    click KEYCL "https://github.com/azure/iot-identity-service/tree/main/key/aziot-key-client-async/"
    click KEYC "https://github.com/azure/iot-identity-service/tree/main/key/aziot-key-common/"
    click KEYENG "https://github.com/azure/iot-identity-service/tree/main/key/aziot-key-openssl-engine/"
    click KEYENGS "https://github.com/azure/iot-identity-service/tree/main/key/aziot-key-openssl-engine-shared/"
    click TPMSH "https://github.com/azure/iot-identity-service/tree/main/tpm/aziot-tpm-common-http/"
    click TPMCL "https://github.com/azure/iot-identity-service/tree/main/tpm/aziot-tpm-client-async/"
    click TSS "https://github.com/azure/iot-identity-service/tree/main/tpm/tss-minimal/"
```
