Deze handleiding legt uit hoe je de credentials correct instelt voor het Windows Update Report MultiTenant script.
Het script gebruikt Azure App Registrations om verbinding te maken met Microsoft Graph API per tenant/klant. Elke klant heeft zijn eigen App Registration nodig met specifieke permissions.
# Kopieer de template naar het werkbestand
Copy-Item "_credentials.json" "credentials.json"Het credentials.json bestand heeft de volgende structuur:
{
"LoginCredentials":[
{"customername":"Customer1", "ClientID": "[Your Client/App ID]", "Secret":"[Your App Secret]", "TenantID": "[Your Tenant ID]", "color": "#1f77b4"},
{"customername":"Customer2", "ClientID": "[Your Client/App ID]", "Secret":"[Your App Secret]", "TenantID": "[Your Tenant ID]", "color": "#ff7f0e"}
]
}Voor elke klant/tenant heb je een App Registration nodig. Volg deze stappen per klant:
- Ga naar Azure Portal
- Navigeer naar Azure Active Directory → App registrations
- Klik op "New registration"
- Vul in:
- Name:
Windows Update Report - [KlantNaam] - Supported account types: "Accounts in this organizational directory only"
- Redirect URI: Laat leeg
- Name:
- Klik "Register"
- Ga naar je nieuwe App Registration
- Klik op "Certificates & secrets"
- Onder "Client secrets", klik "New client secret"
- Vul in:
- Description:
Windows Update Report Secret - Expires: 24 months (aanbevolen)
- Description:
- Klik "Add"
⚠️ BELANGRIJK: Kopieer de Value direct! Deze wordt maar één keer getoond.
- Ga naar "API permissions"
- Klik "Add a permission" → "Microsoft Graph" → "Application permissions"
- Voeg de volgende permissions toe:
DeviceManagementManagedDevices.Read.All
DeviceManagementConfiguration.Read.All
ThreatHunting.Read.All
Device.Read.All
Directory.Read.All
Application.Read.All
- Klik "Add permissions"
⚠️ KRITIEK: Klik "Grant admin consent for [Organization]" en bevestig
Verzamel de volgende gegevens van je App Registration:
- Tenant ID: Azure Portal → Azure Active Directory → Properties → "Tenant ID"
- Client ID: App Registration → Overview → "Application (client) ID"
- Client Secret: De secret value die je in stap 2 hebt gekopieerd
{
"LoginCredentials":[
{
"customername": "mrtn.blog",
"ClientID": "12345678-1234-1234-1234-123456789012",
"Secret": "abcDEF123456~ghiJKL789012.mnoPQR345678",
"TenantID": "87654321-4321-4321-4321-210987654321",
"color": "#1f77b4"
}
]
}{
"LoginCredentials":[
{
"customername": "mrtn.blog",
"ClientID": "12345678-1234-1234-1234-123456789012",
"Secret": "abcDEF123456~ghiJKL789012.mnoPQR345678",
"TenantID": "87654321-4321-4321-4321-210987654321",
"color": "#1f77b4"
},
{
"customername": "Fabrikam",
"ClientID": "98765432-8765-4321-1234-567890123456",
"Secret": "zyxWVU987654~tukRQP321098.lkjHGF654321",
"TenantID": "13579246-9753-1357-2468-135792468024",
"color": "#ff7f0e"
},
{
"customername": "Adventure Works",
"ClientID": "11111111-2222-3333-4444-555555555555",
"Secret": "qwerTY123456~asdfGH789012.zxcvBN345678",
"TenantID": "66666666-7777-8888-9999-000000000000",
"color": "#2ca02c"
}
]
}De color property bepaalt de kleur in de HTML dashboard grafieken. Gebruik unieke hex kleuren per klant:
| Kleur | Hex Code | Voorbeeld |
|---|---|---|
| Blauw | #1f77b4 |
🔵 |
| Oranje | #ff7f0e |
🟠 |
| Groen | #2ca02c |
🟢 |
| Rood | #d62728 |
🔴 |
| Paars | #9467bd |
🟣 |
| Bruin | #8c564b |
🤎 |
| Roze | #e377c2 |
🩷 |
| Grijs | #7f7f7f |
⚫ |
| Geel | #bcbd22 |
🟡 |
| Turquoise | #17becf |
🔷 |
Voor custom kleuren kun je deze tools gebruiken:
- Nooit secrets committen naar Git repositories
- Gebruik
.gitignoreomcredentials.jsonuit te sluiten - Roteer secrets regelmatig (elke 6-12 maanden)
- Gebruik descriptive names voor App Registrations per klant
# Zet restrictieve permissions op credentials file (Windows)
icacls "credentials.json" /inheritance:r /grant:r "$($env:USERNAME):(R,W)"- Genereer nieuwe secret in Azure Portal
- Update
credentials.jsonmet nieuwe secret - Test de connectie
- Verwijder oude secret in Azure Portal
Oorzaak: Admin consent niet gegeven voor API permissions
Oplossing: Ga naar Azure Portal → App Registration → API permissions → "Grant admin consent"
Oorzaak: Verkeerde Tenant ID of Client ID
Oplossing: Controleer Tenant ID en Client ID in Azure Portal
Oorzaak: Verkeerde of verlopen client secret
Oplossing: Genereer nieuwe client secret en update credentials.json
Oorzaak: Ontbrekende API permissions
Oplossing: Controleer of alle required permissions zijn toegevoegd en admin consent is gegeven
Na het instellen kun je de verbinding testen door het script uit te voeren:
.\get-windows-update-report.ps1Het script zal per klant proberen verbinding te maken en eventuele fouten rapporteren.
- README.md - Hoofddocumentatie
- CONFIG-UITLEG.md - Configuratie opties
- Microsoft Graph Permissions Reference
- Azure App Registration Documentation