- 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
235 lines
6.6 KiB
Markdown
235 lines
6.6 KiB
Markdown
# 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
|
|
|
|
1. Ga naar **Azure Portal** → **Microsoft Entra ID** (of **Azure Active Directory**)
|
|
2. Ga naar **Roles and administrators**
|
|
3. 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
|
|
|
|
```bash
|
|
# 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:**
|
|
```json
|
|
{
|
|
"username": "zdlasacr",
|
|
"passwords": [
|
|
{
|
|
"name": "password",
|
|
"value": "xxxxxxxxxxxxx" ← Gebruik deze
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
### Stap 2: Maak Service Connection met "Others"
|
|
|
|
1. **Azure DevOps** → **Project Settings** → **Service connections** → **New service connection**
|
|
2. Kies **"Docker Registry"**
|
|
3. Kies **"Others"** (niet "Azure Container Registry")
|
|
4. Vul in:
|
|
- **Docker Registry**: `zdlasacr.azurecr.io`
|
|
- **Docker ID**: `zdlasacr` (of username uit output)
|
|
- **Docker Password**: `passwords[0].value` uit output
|
|
- **Service connection name**: `zuyderland-cmdb-acr-connection`
|
|
5. 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
|
|
|
|
```bash
|
|
# 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:**
|
|
```json
|
|
{
|
|
"appId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
|
|
"password": "xxxxxxxxxxxxx", ← Gebruik deze
|
|
"tenant": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
|
}
|
|
```
|
|
|
|
### Stap 2: Gebruik in Azure DevOps
|
|
|
|
1. **Azure DevOps** → **Project Settings** → **Service connections** → **New service connection**
|
|
2. Kies **"Docker Registry"** → **"Others"**
|
|
3. Vul in:
|
|
- **Docker Registry**: `zdlasacr.azurecr.io`
|
|
- **Docker ID**: `appId` uit output (de GUID)
|
|
- **Docker Password**: `password` uit output
|
|
- **Service connection name**: `zuyderland-cmdb-acr-connection`
|
|
4. Klik **"Save"**
|
|
|
|
---
|
|
|
|
## 🔍 Check Welke Permissions Je Hebt
|
|
|
|
### Via Azure Portal
|
|
|
|
1. Ga naar **Azure Portal** → **Microsoft Entra ID**
|
|
2. **Roles and administrators**
|
|
3. Zoek je account
|
|
4. Check welke rollen je hebt
|
|
|
|
### Via Azure CLI
|
|
|
|
```bash
|
|
# 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:**
|
|
|
|
1. **Probeer eerst**: Vraag **Application Administrator** rol aan je Azure administrator
|
|
- Dit is de schoonste oplossing
|
|
- Werkt automatisch met Azure Container Registry optie
|
|
|
|
2. **Als dat niet kan**: Gebruik **"Others"** optie met ACR admin credentials
|
|
- Werkt altijd
|
|
- Geen extra permissions nodig
|
|
- Iets minder geautomatiseerd, maar volledig functioneel
|
|
|
|
3. **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:
|
|
|
|
```bash
|
|
# 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:
|
|
1. ACR naam is correct: `zdlasacr`
|
|
2. Credentials zijn correct
|
|
3. ACR is toegankelijk vanuit je netwerk
|
|
4. Firewall rules staan toe
|
|
|
|
---
|
|
|
|
## 📚 Gerelateerde Documentatie
|
|
|
|
- **`AZURE-PIPELINES.md`** - Pipeline troubleshooting (includes MSI error fix)
|
|
- **`AZURE-SERVICE-CONNECTION-TROUBLESHOOTING.md`** - Algemene troubleshooting
|
|
- **`AZURE-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.
|