# yann-mickael/active-directory-sous-powershell architecture

> Architecture diagram of the GitHub repository yann-mickael/active-directory-sous-powershell, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yann-mickael/active-directory-sous-powershell
- Repository: https://github.com/yann-mickael/active-directory-sous-powershell

## Overview

##### Project Type & Purpose
This is a PowerShell–based automation toolkit whose purpose is to configure a Windows Server 2012 R2 as an Active Directory Domain Controller, deploy required services (AD DS, DNS, RSAT), create a new AD forest (laplateforme.io), and import users/groups from a CSV file into an OU. It’s essentially an infrastructure‐as‐code script suite rather than a multi‐tier application.

##### Main Components
- Administrator & Script Runner
– The administrator workstation or CI/CD host from which the .ps1 scripts are invoked.
- Input Data
– Utilisateurs.csv (semicolon-delimited list of user attributes and group names).
- PowerShell Scripts (.ps1 files)
– Renommer le server.ps1 (rename & reboot)
– Configuration réseau.ps1 (static IP, DNS, interface rename, firewall rule)
– Installation des rôles.ps1 (install AD-DS, DNS, RSAT modules)
– (Embedded in scripts) ADDSDeployment module use & Install-ADDSForest (forest creation)
– Création Utilisateurs-Groupes.ps1 (create OU “Personnel”, groups, users, add members)
- Target Server Infrastructure
– Windows Server 2012 R2 VM (Domain Controller)
– Services: Active Directory Domain Services, DNS Server, RSAT-AD-PowerShell
– NTDS database & SYSVOL paths on C:\Windows
- Organizational Structures in AD
– Forest: Laplateforme.io
– Domain NetBIOS: LAPLATEFORME
– OU “Personnel” containing groups and users
- Network Layer
– LAN interface with static IP (192.168.1.5/24), gateway (192.168.1.254), loopback DNS
– ICMPv4 firewall rule for client-domain join
- Client Integration
– Windows 10 VM(s) configured to join the domain via DNS resolution of the DC

##### Relationships & Data Flow
– Administrator invokes scripts → scripts read Utilisateurs.csv → configure network → install roles → call Install-ADDSForest → server becomes DC + DNS authoritative for laplateforme.io → scripts parse CSV → create groups then users in OU=Personnel → Add-ADGroupMember calls populate group memberships.
– Clients query DNS on the DC → join domain → authenticate against AD DS → users log in using newly created accounts.

##### Architectural Patterns & Principles
- Modular, sequential pipeline: each .ps1 handles a discrete step, idempotent checks (Get-ADGroup/Get-ADUser) avoid duplicates.
- Declarative configuration: scripts define desired state (IP config, features, AD structure).
- Data‐driven provisioning: external CSV drives user/group creation, making it extensible.
- Use of built-in Windows features & modules (ADDSDeployment, RSAT-AD-PowerShell).

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Administrator & Script Runner"
        PSConsole["PowerShell Console"]:::vm
        CSV["Utilisateurs.csv"]:::data
        RenameScript["Renommer le server.ps1"]:::script
        NetScript["Configuration réseau.ps1"]:::script
        RoleScript["Installation des rôles.ps1"]:::script
        UserGroupScript["Création Utilisateurs-Groupes.ps1"]:::script
        AltUserScript["Création Utilisateur.ps1"]:::script
        README["README.md"]:::doc
    end

    subgraph "Target Domain Controller VM"
        ServerVM["Windows Server 2012 R2 VM"]:::vm
        ForestMod["Install-ADDSForest (ADDSDeployment)"]:::module
        ADService["AD DS & DNS Service"]:::service
        DB["NTDS Database & SYSVOL"]:::db
    end

    subgraph "Network"
        LAN["LAN Interface\n192.168.1.5/24\nDNS: loopback"]:::network
    end

    subgraph "Client VMs"
        ClientVM["Windows 10 VM"]:::vm
    end

    PSConsole --> RenameScript
    RenameScript --> ServerVM
    PSConsole --> NetScript
    NetScript --> ServerVM
    PSConsole --> RoleScript
    RoleScript --> ServerVM
    RoleScript --> ForestMod
    ForestMod --> ADService
    ADService --> DB
    PSConsole --> UserGroupScript
    CSV --> UserGroupScript
    UserGroupScript --> ADService
    ClientVM --> LAN
    LAN --> ServerVM
    ClientVM -->|"DNS query & domain join"| ServerVM

    click CSV "https://github.com/yann-mickael/active-directory-sous-powershell/blob/main/Utilisateurs.csv"
    click RenameScript "https://github.com/yann-mickael/active-directory-sous-powershell/blob/main/Renommer le server.ps1"
    click NetScript "https://github.com/yann-mickael/active-directory-sous-powershell/blob/main/Configuration réseau.ps1"
    click RoleScript "https://github.com/yann-mickael/active-directory-sous-powershell/blob/main/Installation des rôles.ps1"
    click UserGroupScript "https://github.com/yann-mickael/active-directory-sous-powershell/blob/main/Création Utilisateurs-Groupes.ps1"
    click AltUserScript "https://github.com/yann-mickael/active-directory-sous-powershell/blob/main/Création Utilisateur.ps1"
    click README "https://github.com/yann-mickael/active-directory-sous-powershell/blob/main/README.md"

    classDef script fill:#1f77b4,stroke:#000,color:#fff
    classDef data fill:#ff7f0e,stroke:#000,color:#000
    classDef vm fill:#9467bd,stroke:#000,color:#000
    classDef module fill:#17becf,stroke:#000,color:#000
    classDef service fill:#2ca02c,stroke:#000,color:#fff
    classDef db fill:#2ca02c,stroke:#000,color:#fff,stroke-width:2px
    classDef network fill:#7f7f7f,stroke:#000,color:#000
    classDef doc fill:#bcbd22,stroke:#000,color:#000
```
