- Reorganize docs into 'Core deployment guides' and 'Setup and configuration' subdirectories - Consolidate redundant documentation files (ACR, pipelines, deployment guides) - Add documentation consolidation plan - Update backend database factory and logger services - Update migration script and docker-compose configurations - Add PostgreSQL setup script
6.6 KiB
Azure DevOps Service Connection - Permissions Error Fix
🔴 Error Message
Failed to create an app in Microsoft Entra.
Error: Insufficient privileges to complete the operation in Microsoft Graph
Ensure that the user has permissions to create a Microsoft Entra Application.
🎯 Probleem
Je account heeft onvoldoende rechten in Microsoft Entra (Azure AD) om automatisch een Service Principal aan te maken. Azure DevOps probeert dit automatisch te doen wanneer je een service connection aanmaakt.
✅ Oplossing 1: Vraag Permissions Aan (Aanbevolen)
Stap 1: Check Huidige Permissions
- Ga naar Azure Portal → Microsoft Entra ID (of Azure Active Directory)
- Ga naar Roles and administrators
- Zoek je account en check welke rol je hebt
Benodigde rollen:
- Application Administrator (aanbevolen)
- Cloud Application Administrator
- Global Administrator (heeft alle rechten)
Stap 2: Vraag Permissions Aan
Optie A: Vraag aan Azure Administrator
- Contacteer je Azure/IT administrator
- Vraag om Application Administrator of Cloud Application Administrator rol
- Of vraag om een Service Principal aan te maken voor jou
Optie B: Vraag om Service Principal Aan te Maken
- Vraag je administrator om een Service Principal aan te maken
- Gebruik deze in de "Others" optie (zie Oplossing 2)
✅ Oplossing 2: Gebruik "Others" Optie met Bestaande Credentials
Als je geen permissions kunt krijgen, gebruik dan de "Others" optie met ACR admin credentials:
Stap 1: Haal ACR Admin Credentials Op
# Login bij Azure
az login
# Check of admin is enabled
az acr show --name zdlasacr --query adminEnabled
# Als false, enable admin (vereist Contributor of Owner rol op ACR)
az acr update --name zdlasacr --admin-enabled true
# Haal admin credentials op
az acr credential show --name zdlasacr
Output:
{
"username": "zdlasacr",
"passwords": [
{
"name": "password",
"value": "xxxxxxxxxxxxx" ← Gebruik deze
}
]
}
Stap 2: Maak Service Connection met "Others"
- Azure DevOps → Project Settings → Service connections → New service connection
- Kies "Docker Registry"
- Kies "Others" (niet "Azure Container Registry")
- Vul in:
- Docker Registry:
zdlasacr.azurecr.io - Docker ID:
zdlasacr(of username uit output) - Docker Password:
passwords[0].valueuit output - Service connection name:
zuyderland-cmdb-acr-connection
- Docker Registry:
- Klik "Save"
✅ Dit werkt zonder extra Azure AD permissions!
✅ Oplossing 3: Vraag Administrator om Service Principal
Als je administrator een Service Principal voor je kan aanmaken:
Stap 1: Administrator Maakt Service Principal
# Administrator voert uit:
az login
# Maak Service Principal met ACR push permissions
az ad sp create-for-rbac \
--name "zuyderland-cmdb-acr-sp" \
--role acrpush \
--scopes /subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.ContainerRegistry/registries/zdlasacr
Output:
{
"appId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"password": "xxxxxxxxxxxxx", ← Gebruik deze
"tenant": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
Stap 2: Gebruik in Azure DevOps
- Azure DevOps → Project Settings → Service connections → New service connection
- Kies "Docker Registry" → "Others"
- Vul in:
- Docker Registry:
zdlasacr.azurecr.io - Docker ID:
appIduit output (de GUID) - Docker Password:
passworduit output - Service connection name:
zuyderland-cmdb-acr-connection
- Docker Registry:
- Klik "Save"
🔍 Check Welke Permissions Je Hebt
Via Azure Portal
- Ga naar Azure Portal → Microsoft Entra ID
- Roles and administrators
- Zoek je account
- Check welke rollen je hebt
Via Azure CLI
# Login
az login
# Check je rollen
az role assignment list --assignee $(az account show --query user.name -o tsv) --all
# Check specifiek voor Microsoft Entra ID
az ad signed-in-user show --query "displayName"
📋 Benodigde Permissions Overzicht
| Rol | Kan Service Principal Aanmaken? | Kan ACR Toegang Geven? |
|---|---|---|
| Global Administrator | ✅ Ja | ✅ Ja |
| Application Administrator | ✅ Ja | ✅ Ja |
| Cloud Application Administrator | ✅ Ja | ✅ Ja |
| User | ❌ Nee | ❌ Nee |
| Contributor (op Resource Group) | ❌ Nee | ✅ Ja (op resources) |
Voor Azure DevOps Service Connection:
- Je hebt Application Administrator of hoger nodig om automatisch Service Principal aan te maken
- Of gebruik "Others" optie met bestaande credentials (geen extra permissions nodig)
💡 Aanbeveling
Voor jouw situatie:
-
Probeer eerst: Vraag Application Administrator rol aan je Azure administrator
- Dit is de schoonste oplossing
- Werkt automatisch met Azure Container Registry optie
-
Als dat niet kan: Gebruik "Others" optie met ACR admin credentials
- Werkt altijd
- Geen extra permissions nodig
- Iets minder geautomatiseerd, maar volledig functioneel
-
Alternatief: Vraag administrator om Service Principal aan te maken
- Gebruik deze in "Others" optie
- Veiliger dan admin credentials
🔧 Troubleshooting
"Admin is not enabled" Error
Als ACR admin niet is enabled:
# Enable admin (vereist Contributor of Owner op ACR)
az acr update --name zdlasacr --admin-enabled true
Als je geen permissions hebt:
- Vraag je administrator om admin te enableen
- Of gebruik Service Principal (zie Oplossing 3)
"Cannot connect to ACR" Error
Check:
- ACR naam is correct:
zdlasacr - Credentials zijn correct
- ACR is toegankelijk vanuit je netwerk
- Firewall rules staan toe
📚 Gerelateerde Documentatie
AZURE-PIPELINES.md- Pipeline troubleshooting (includes MSI error fix)AZURE-SERVICE-CONNECTION-TROUBLESHOOTING.md- Algemene troubleshootingAZURE-ACR-SETUP.md- ACR setup (includes permissions)
✅ Quick Fix Checklist
- Check huidige Azure AD rol
- Vraag Application Administrator rol aan (optie 1)
- OF gebruik "Others" optie met ACR admin credentials (optie 2)
- OF vraag administrator om Service Principal aan te maken (optie 3)
- Test service connection
- Test pipeline
💡 Tip: De "Others" optie is een volledig werkende oplossing en vereist geen extra Azure AD permissions. Het is iets minder geautomatiseerd, maar werkt perfect voor CI/CD pipelines.