Files
cmdb-insight/docs/AZURE-CLI-QUICKSTART.md
Bert Hausmans 81d477ec8c Fix TypeScript compilation errors
- Add searchReference to ApplicationListItem type
- Fix result variable in toApplicationDetails function
- Add query helper functions for req.query parameter handling
- Fix req.query.* type errors in routes (applications, cache, classifications, objects)
- Fix CompletenessCategoryConfig missing id property
- Fix number | null type errors in dataService
- Add utils/queryHelpers.ts for reusable query parameter helpers
2026-01-14 16:36:22 +01:00

271 lines
6.1 KiB
Markdown

# Azure CLI - Quick Start Guide
## 📍 Waar voer je deze commando's uit?
Je voert deze commando's uit in de **Terminal** (command line) op je computer.
---
## 🖥️ Terminal Openen
### Op macOS (jouw situatie):
1. **Open Terminal:**
- Druk op `Cmd + Space` (Spotlight)
- Typ "Terminal"
- Druk Enter
- Of: Applications → Utilities → Terminal
2. **Of gebruik iTerm2** (als je die hebt geïnstalleerd)
### Op Windows:
- **PowerShell** of **Command Prompt**
- Druk `Win + R`, typ `powershell`, Enter
### Op Linux:
- Open je terminal emulator (bijv. GNOME Terminal, Konsole)
---
## ✅ Stap 1: Check of Azure CLI Geïnstalleerd is
**Voer dit commando uit in de terminal:**
```bash
az --version
```
**Als je een versie ziet** (bijv. `azure-cli 2.50.0`): ✅ Azure CLI is geïnstalleerd, ga door naar Stap 2.
**Als je een foutmelding krijgt** (bijv. `command not found`): ❌ Azure CLI is niet geïnstalleerd, zie installatie hieronder.
---
## 📥 Stap 2: Azure CLI Installeren (als nodig)
### Op macOS:
**Optie A: Met Homebrew (Aanbevolen)**
```bash
# Installeer Homebrew (als je die nog niet hebt)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Installeer Azure CLI
brew install azure-cli
```
**Optie B: Met Installer**
1. Download: https://aka.ms/installazureclimac
2. Open het `.pkg` bestand
3. Volg de installatie wizard
**Optie C: Met pip (Python)**
```bash
pip3 install azure-cli
```
### Op Windows:
1. Download: https://aka.ms/installazurecliwindows
2. Run de `.msi` installer
3. Volg de installatie wizard
### Op Linux:
```bash
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
```
**Na installatie, check opnieuw:**
```bash
az --version
```
---
## 🔐 Stap 3: Login bij Azure
**Voer dit commando uit:**
```bash
az login
```
**Wat gebeurt er:**
1. Je browser opent automatisch
2. Log in met je Azure account (hetzelfde account dat je gebruikt voor Azure Portal)
3. Na succesvol inloggen, sluit je de browser
4. De terminal toont je subscriptions
**Als browser niet opent automatisch:**
- Je krijgt een code en URL in de terminal
- Kopieer de code
- Open de URL in je browser
- Voer de code in
**Verwachte output:**
```
[
{
"cloudName": "AzureCloud",
"id": "12345678-1234-1234-1234-123456789012",
"name": "Subscription Name",
"state": "Enabled",
...
}
]
```
**✅ Je bent nu ingelogd!**
---
## 🔍 Stap 4: Haal ACR Credentials Op
**Voer dit commando uit:**
```bash
az acr credential show --name zdlas
```
**Verwachte output:**
```json
{
"passwords": [
{
"name": "password",
"value": "abc123xyz..."
},
{
"name": "password2",
"value": "def456uvw..."
}
],
"username": "zdlas"
}
```
**Noteer:**
- **Username**: `zdlas` (of wat er staat)
- **Password**: Gebruik `passwords[0].value` (de eerste password)
**⚠️ Belangrijk:** Deze credentials zijn gevoelig! Deel ze niet en gebruik ze alleen voor de service connection.
---
## 📋 Complete Stappen in Terminal
**Hier is de complete reeks commando's:**
```bash
# 1. Check of Azure CLI geïnstalleerd is
az --version
# 2. Login bij Azure (opent browser)
az login
# 3. Haal ACR credentials op
az acr credential show --name zdlas
```
**Kopieer de output** en gebruik de `username` en `passwords[0].value` in Azure DevOps.
---
## 🔄 Alternatief: Via Azure Portal (Zonder Azure CLI)
**Als je Azure CLI niet wilt installeren, kun je credentials ook via Azure Portal ophalen:**
1. **Ga naar Azure Portal**: https://portal.azure.com
2. **Ga naar je Container Registry**: Zoek naar `zdlas`
3. **Klik op "Access keys"** (links in het menu)
4. **Je ziet:**
- **Login server**: `zdlas.azurecr.io`
- **Username**: `zdlas` (of admin username)
- **Password**: Klik op "Show" naast password om het te zien
- **Password2**: Alternatieve password
5. **Kopieer de username en password**
**✅ Dit is hetzelfde als `az acr credential show`!**
---
## 🎯 Voor Jouw Situatie (Service Connection)
**Gebruik deze credentials in Azure DevOps:**
1. **In de service connection wizard:**
- Kies "Docker Registry" → "Others"
- **Docker Registry**: `zdlas.azurecr.io`
- **Docker ID**: `zdlas` (of de username uit de output)
- **Docker Password**: `passwords[0].value` (uit de output)
- **Service connection name**: `zuyderland-cmdb-acr-connection`
2. **Save**
---
## 🚨 Troubleshooting
### "az: command not found"
**Oplossing:** Azure CLI is niet geïnstalleerd
- Installeer Azure CLI (zie Stap 2 hierboven)
- Of gebruik Azure Portal alternatief (zie hierboven)
### "az login" opent geen browser
**Oplossing:**
- Kopieer de code en URL uit de terminal
- Open de URL handmatig in je browser
- Voer de code in
### "Subscription not found" of "Access denied"
**Oplossing:**
- Check of je ingelogd bent met het juiste Azure account
- Check of je toegang hebt tot de subscription waar de ACR staat
- Probeer: `az account list` om je subscriptions te zien
- Selecteer de juiste subscription: `az account set --subscription "Subscription Name"`
### "ACR not found"
**Oplossing:**
- Check of de ACR naam correct is: `zdlas`
- Check of je toegang hebt tot de ACR
- Probeer: `az acr list` om alle ACR's te zien
---
## 💡 Tips
1. **Azure CLI blijft ingelogd** - Je hoeft niet elke keer `az login` te doen
2. **Check je subscription** - Als je meerdere subscriptions hebt: `az account show`
3. **Wissel subscription** - `az account set --subscription "Subscription Name"`
4. **Logout** - `az logout` (als je klaar bent)
---
## 📚 Meer Informatie
- [Azure CLI Installatie](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli)
- [Azure CLI Login](https://learn.microsoft.com/en-us/cli/azure/authenticate-azure-cli)
- [ACR Credentials](https://learn.microsoft.com/en-us/azure/container-registry/container-registry-authentication)
---
## 🎯 Quick Reference
**Terminal openen:**
- macOS: `Cmd + Space` → "Terminal"
**Azure CLI commando's:**
```bash
az --version # Check installatie
az login # Login bij Azure
az acr credential show --name zdlas # Haal credentials op
```
**Azure Portal alternatief:**
- Portal → Container Registry → Access keys
**Klaar!** 🚀