Prompt Engineering Voor Microsoft Copilot Beveiliging
📅 2025-01-20
•
⏱️ 45 minuten lezen
•
🔴 Must-Have
💼 Management Samenvatting
Deze gids over prompt engineering voor Microsoft Copilot beveiliging biedt organisaties een uitgebreide aanpak voor het veilig gebruik van prompts binnen Microsoft Copilot.
Aanbeveling
IMPLEMENT
Risico zonder
High
Risk Score
8/10
Implementatie
140u (tech: 80u)
Van toepassing op:
✓ M365 ✓ Microsoft Copilot ✓ Microsoft 365 E3 ✓ Microsoft 365 E5 ✓ Microsoft Copilot for Microsoft 365
Prompt engineering is essentieel voor beveiliging.
PowerShell Modules Vereist
Primary API: Microsoft Graph API / Microsoft 365 Admin Center Connection:Connect-MgGraph / Connect-ExchangeOnline Required Modules: Microsoft.Graph, Microsoft.Graph.Identity.DirectoryManagement, ExchangeOnlineManagement
Implementatie
Deze gids behandelt prompt engineering technieken.
Compliance & Frameworks
CIS M365: Control 6.1 (L1) - Implementeer beveiligingsconfiguraties voor AI-systemen en cloud services
BIO: 5.1, 8.1, 12.1, 12.2 - Toegangscontrole, encryptie, logging en monitoring, en incident detectie voor AI-systemen
ISO 27001:2022: A.9.1.1, A.10.1.1, A.12.4.1 - Toegangscontrole, cryptografie, en logging en monitoring voor AI-systemen
NIS2: Artikel - Beveiligingsmaatregelen en incident detectie en respons voor essentiële en belangrijke entiteiten
Automation
Gebruik het onderstaande PowerShell script om deze security control te monitoren en te implementeren. Het script bevat functies voor zowel monitoring (-Monitoring) als remediation (-Remediation).
PowerShell
<#
.SYNOPSIS
Prompt Engineering Best Practices voor Microsoft Copilot Beveiliging in Microsoft 365
.DESCRIPTION
Zorgt ervoor dat alle essentiële prompt engineering best practices correct zijn geïmplementeerd voor Microsoft Copilot,
inclusief prompt formulering technieken, context management, output optimalisatie en compliance-richtlijnen.
Essentieel voor compliance met BIO, AVG en NIS2 en het maximaliseren van productiviteit en effectiviteit van Copilot-gebruik.
.NOTES
Filename: prompt-engineering.ps1
Author: Nederlandse Baseline voor Veilige Cloud
Category: copilot-security
Related JSON: content/copilot/security/prompt-engineering.json
.EXAMPLE
.\prompt-engineering.ps1 -Monitoring
Controleer of alle prompt engineering best practices correct zijn geïmplementeerd
.EXAMPLE
.\prompt-engineering.ps1 -Remediation
Herstel ontbrekende of incorrecte prompt engineering best practices
#>
#Requires -Version 5.1#Requires -Modules Microsoft.Graph, Microsoft.Graph.Identity.DirectoryManagement
[CmdletBinding()]
param(
[Parameter(Mandatory = $false)]
[switch]$Monitoring,
[Parameter(Mandatory = $false)]
[switch]$Remediation,
[Parameter(Mandatory = $false)]
[switch]$Revert,
[Parameter(Mandatory = $false)]
[switch]$WhatIf
)
$ErrorActionPreference = 'Stop'
Write-Host "`n========================================" -ForegroundColor Cyan
Write-Host "Copilot Prompt Engineering Best Practices" -ForegroundColor Cyan
Write-Host "Nederlandse Baseline voor Veilige Cloud" -ForegroundColor Cyan
Write-Host "========================================`n" -ForegroundColor Cyan
function Invoke-Monitoring {
<#
.SYNOPSIS
Controleert of alle prompt engineering best practices correct zijn geïmplementeerd
#>
try {
Write-Host "Verbinding maken met Microsoft Graph..." -ForegroundColor Gray
Connect-MgGraph -Scopes "User.Read.All", "Policy.Read.All", "AuditLog.Read.All", "Directory.Read.All" -ErrorAction Stop | Out-Null
$issues = @()
$compliant = $true# Controleren of Copilot-licenties zijn geconfigureerd
Write-Host "`nControleren Copilot-licentie configuratie..." -ForegroundColor Gray
try {
$copilotUsers = Get-MgUser -Filter "assignedLicenses/any(x:x/skuId eq 'c42b9cae-ea4f-4ab7-9717-81576235ccac')" -Top 10 -ErrorAction SilentlyContinue
if ($null -eq $copilotUsers -or $copilotUsers.Count -eq 0) {
Write-Host " [INFO] Geen gebruikers met Copilot-licenties gevonden (mogelijk nog niet geconfigureerd)" -ForegroundColor Gray
}
else {
Write-Host " [OK] $($copilotUsers.Count) gebruiker(s) met Copilot-licenties gevonden" -ForegroundColor Green
}
}
catch {
Write-Host " [WARN] Kan Copilot-licentie configuratie niet controleren: $($_.Exception.Message)" -ForegroundColor Yellow
$issues += "Kan Copilot-licentie configuratie niet verifiëren"
}
# Controleren Conditional Access policies voor Copilot-toegang
Write-Host "`nControleren Conditional Access policies voor Copilot..." -ForegroundColor Gray
try {
$caPolicies = Get-MgIdentityConditionalAccessPolicy -ErrorAction Stop
if ($caPolicies.Count -eq 0) {
Write-Host " [WARN] Geen Conditional Access policies gevonden" -ForegroundColor Yellow
$issues += "Geen Conditional Access policies geconfigureerd (aanbevolen voor prompt engineering)"
}
else {
$enabledPolicies = $caPolicies | Where-Object { $_.State -eq 'enabled' }
Write-Host " [OK] $($enabledPolicies.Count) actieve Conditional Access policy(ies) gevonden" -ForegroundColor Green
# Controleren of MFA is vereist
$mfaPolicies = $enabledPolicies | Where-Object {
$_.GrantControls -and
$_.GrantControls.BuiltInControls -contains 'mfa'
}
if ($mfaPolicies.Count -eq 0) {
Write-Host " [WARN] Geen Conditional Access policies met MFA-vereiste gevonden" -ForegroundColor Yellow
$issues += "Geen MFA-vereiste geconfigureerd in Conditional Access policies (aanbevolen voor prompt engineering)"
}
else {
Write-Host " [OK] MFA-vereiste geconfigureerd in $($mfaPolicies.Count) policy(ies)" -ForegroundColor Green
}
}
}
catch {
Write-Host " [WARN] Kan Conditional Access policies niet controleren: $($_.Exception.Message)" -ForegroundColor Yellow
$issues += "Kan Conditional Access policies niet verifiëren"
}
# Controleren Unified Audit Log status voor prompt logging
Write-Host "`nControleren Unified Audit Log status voor prompt logging..." -ForegroundColor Gray
try {
$auditConfig = Get-MgDirectoryAudit -ErrorAction Stop
if ($null -eq $auditConfig -or $auditConfig.Count -eq 0) {
Write-Host " [WARN] Unified Audit Log: Kan status niet verifiëren" -ForegroundColor Yellow
$issues += "Unified Audit Log status kan niet worden geverifieerd (essentieel voor prompt engineering monitoring)"
$compliant = $false
}
else {
Write-Host " [OK] Unified Audit Log: Actief" -ForegroundColor Green
}
}
catch {
Write-Host " [WARN] Kan Unified Audit Log status niet controleren: $($_.Exception.Message)" -ForegroundColor Yellow
$issues += "Kan Unified Audit Log status niet verifiëren"
}
# Controleren op Copilot-activiteiten in audit logs
Write-Host "`nControleren Copilot prompt-activiteiten in audit logs..." -ForegroundColor Gray
try {
$recentLogs = Search-MgAuditLog -RecordType "MicrosoftGraphActivity" -ErrorAction SilentlyContinue |
Where-Object { $_.ActivityDisplayName -like "*Copilot*" -or $_.ActivityDisplayName -like "*Prompt*" } |
Select-Object -First 10if ($recentLogs.Count -eq 0) {
Write-Host " [INFO] Geen recente Copilot prompt-activiteiten gevonden in audit logs" -ForegroundColor Gray
Write-Host " (Dit kan normaal zijn als Copilot nog niet actief wordt gebruikt)" -ForegroundColor Gray
}
else {
Write-Host " [OK] Copilot prompt-activiteiten worden gelogd ($($recentLogs.Count) recente activiteiten gevonden)" -ForegroundColor Green
}
}
catch {
Write-Host " [WARN] Kan Copilot prompt audit logs niet controleren: $($_.Exception.Message)" -ForegroundColor Yellow
$issues += "Kan Copilot prompt audit logging niet verifiëren"
}
# Controleren Data Loss Prevention (DLP) policies voor prompt engineering
Write-Host "`nControleren Data Loss Prevention (DLP) policies voor prompt engineering..." -ForegroundColor Gray
try {
# Nota: DLP policies vereisen Exchange Online Management module voor volledige verificatie
Write-Host " [INFO] DLP policies vereisen Exchange Online Management module voor volledige verificatie" -ForegroundColor Gray
Write-Host " (Volledige DLP-check kan worden uitgevoerd met ExchangeOnlineManagement module)" -ForegroundColor Gray
Write-Host " Aanbeveling: Configureer DLP policies specifiek voor Copilot prompt-activiteiten" -ForegroundColor Cyan
Write-Host " Aanbeveling: Implementeer prompt templates en libraries voor gebruikers" -ForegroundColor Cyan
Write-Host " Aanbeveling: Ontwikkel context management richtlijnen voor effectieve prompts" -ForegroundColor Cyan
}
catch {
Write-Host " [INFO] DLP policies kunnen niet worden gecontroleerd zonder Exchange Online Management module" -ForegroundColor Gray
}
# Controleren Microsoft Purview Compliance Portal configuratie voor prompt engineering
Write-Host "`nControleren Microsoft Purview Compliance Portal voor prompt engineering..." -ForegroundColor Gray
try {
# Nota: Purview vereist specifieke modules en configuratie
Write-Host " [INFO] Microsoft Purview Compliance Portal vereist aanvullende configuratie" -ForegroundColor Gray
Write-Host " Aanbeveling: Ontwikkel prompt libraries en templates voor gebruikers" -ForegroundColor Cyan
Write-Host " Aanbeveling: Configureer context management richtlijnen voor prompts" -ForegroundColor Cyan
Write-Host " Aanbeveling: Implementeer output optimalisatie en verificatie processen" -ForegroundColor Cyan
Write-Host " Aanbeveling: Ontwikkel beveiligingsrichtlijnen voor prompt formulering" -ForegroundColor Cyan
}
catch {
Write-Host " [INFO] Microsoft Purview Compliance Portal configuratie kan niet worden gecontroleerd" -ForegroundColor Gray
}
# Samenvatting
Write-Host "`n========================================" -ForegroundColor Cyan
if ($compliant -and $issues.Count -eq 0) {
Write-Host "[OK] COMPLIANT" -ForegroundColor Green
Write-Host "Prompt engineering best practices lijken correct geïmplementeerd te zijn." -ForegroundColor Cyan
Write-Host "`nAanbeveling: Verifieer ook prompt libraries, context management en output optimalisatie voor volledige implementatie." -ForegroundColor Cyan
exit 0
}
else {
Write-Host "[WARN] REVIEW REQUIRED" -ForegroundColor Yellow
if ($issues.Count -gt 0) {
Write-Host "`nGevonden aandachtspunten:" -ForegroundColor Yellow
foreach ($issue in $issues) {
Write-Host " - $issue" -ForegroundColor Gray
}
}
Write-Host "`nAanbeveling: Review prompt engineering best practices en zorg dat alle vereiste instellingen aanwezig zijn." -ForegroundColor Cyan
Write-Host "Voor volledige verificatie is het aan te raden ook prompt libraries, context management en output optimalisatie te controleren." -ForegroundColor Cyan
exit 1
}
}
catch {
Write-Host "`n[FAIL] FOUT: $_" -ForegroundColor Red
Write-Host "Foutdetails: $($_.Exception.Message)" -ForegroundColor Red
exit 2
}
finally {
try {
Disconnect-MgGraph -ErrorAction SilentlyContinue
}
catch {
# Negeer disconnect fouten
}
}
}
function Invoke-Remediation {
<#
.SYNOPSIS
Herstelt ontbrekende of incorrecte prompt engineering best practices
#>
try {
Write-Host "Verbinding maken met Microsoft Graph..." -ForegroundColor Gray
Connect-MgGraph -Scopes "User.ReadWrite.All", "Policy.ReadWrite.All", "AuditLog.ReadWrite.All", "Directory.ReadWrite.All" -ErrorAction Stop | Out-Null
$remediationsApplied = @()
Write-Host "`n========================================" -ForegroundColor Cyan
Write-Host "COPILOT PROMPT ENGINEERING IMPLEMENTATIE" -ForegroundColor Cyan
Write-Host "========================================`n" -ForegroundColor Cyan
Write-Host "De volgende stappen zijn vereist voor volledige prompt engineering implementatie:" -ForegroundColor Cyan
Write-Host ""
Write-Host "1. PROMPT FORMULERING TECHNIEKEN" -ForegroundColor Yellow
Write-Host " - Ontwikkel prompt templates die gebruikers kunnen gebruiken als basis" -ForegroundColor Gray
Write-Host " - Definieer welke elementen een effectieve prompt moet bevatten (context, instructies, voorbeelden)" -ForegroundColor Gray
Write-Host " - Ontwikkel richtlijnen voor het formuleren van duidelijke, specifieke en veilige prompts" -ForegroundColor Gray
Write-Host " - Instructeer gebruikers om geen gevoelige informatie in prompts op te nemen" -ForegroundColor Gray
Write-Host " - Vermijd prompts die kunnen leiden tot prompt-injection aanvallen" -ForegroundColor Gray
Write-Host ""
Write-Host "2. CONTEXT MANAGEMENT" -ForegroundColor Yellow
Write-Host " - Ontwikkel context management richtlijnen voor effectieve prompts" -ForegroundColor Gray
Write-Host " - Definieer welke soorten context relevant zijn voor verschillende use cases" -ForegroundColor Gray
Write-Host " - Implementeer mechanismen voor het beheren van context op organisatieniveau" -ForegroundColor Gray
Write-Host " - Ontwikkel centrale prompt libraries die gebruikers kunnen gebruiken als referentie" -ForegroundColor Gray
Write-Host " - Creëer context templates die gebruikers kunnen aanpassen voor hun specifieke behoeften" -ForegroundColor Gray
Write-Host ""
Write-Host "3. OUTPUT OPTIMALISATIE EN VERIFICATIE" -ForegroundColor Yellow
Write-Host " - Instructeer gebruikers in technieken voor het optimaliseren van Copilot-outputs" -ForegroundColor Gray
Write-Host " - Implementeer iteratieve prompt refinement processen" -ForegroundColor Gray
Write-Host " - Configureer output-formaat specificaties voor consistente resultaten" -ForegroundColor Gray
Write-Host " - Ontwikkel processen voor het verifiëren van Copilot-outputs voordat deze worden gebruikt" -ForegroundColor Gray
Write-Host " - Implementeer automatische verificatie mechanismen voor compliance" -ForegroundColor Gray
Write-Host ""
Write-Host "4. BEVEILIGINGSBEST PRACTICES EN COMPLIANCE" -ForegroundColor Yellow
Write-Host " - Stel Prompt Engineering Security Guidelines document op" -ForegroundColor Gray
Write-Host " - Configureer privacy-instellingen volgens AVG-vereisten voor prompts" -ForegroundColor Gray
Write-Host " - Implementeer governance-processen voor het beheren van prompt-gebruik" -ForegroundColor Gray
Write-Host " - Ontwikkel privacy-richtlijnen voor bescherming van persoonsgegevens in prompts" -ForegroundColor Gray
Write-Host " - Implementeer automatische detectie mechanismen voor gevoelige informatie in prompts" -ForegroundColor Gray
Write-Host ""
Write-Host "5. TRAINING EN ONTWIKKELING" -ForegroundColor Yellow
Write-Host " - Organiseer training voor gebruikers over prompt engineering technieken" -ForegroundColor Gray
Write-Host " - Ontwikkel prompt libraries met voorbeelden voor verschillende use cases" -ForegroundColor Gray
Write-Host " - Implementeer continue verbetering processen voor prompt effectiviteit" -ForegroundColor Gray
Write-Host " - Documenteer best practices en lessen geleerd uit praktijkervaringen" -ForegroundColor Gray
Write-Host " - Deel kennis met andere organisaties via ISACs of samenwerkingsverbanden" -ForegroundColor Gray
Write-Host ""
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "[INFO] REMEDIATIE VEREIST HANDMATIGE CONFIGURATIE" -ForegroundColor Yellow
Write-Host "`nVoor volledige implementatie van prompt engineering best practices:" -ForegroundColor Cyan
Write-Host "1. Ontwikkel prompt templates en libraries via Microsoft Purview Compliance Portal" -ForegroundColor Gray
Write-Host "2. Configureer context management richtlijnen via Microsoft 365 Admin Center" -ForegroundColor Gray
Write-Host "3. Implementeer output optimalisatie en verificatie processen" -ForegroundColor Gray
Write-Host "4. Schakel Unified Audit Logging in via Exchange Online Management" -ForegroundColor Gray
Write-Host "5. Documenteer alle best practices en processen voor compliance-doeleinden" -ForegroundColor Gray
Write-Host "`nZie het artikel voor gedetailleerde implementatie-instructies." -ForegroundColor Cyan
exit 0
}
catch {
Write-Host "`n[FAIL] FOUT: $_" -ForegroundColor Red
Write-Host "Foutdetails: $($_.Exception.Message)" -ForegroundColor Red
exit 2
}
finally {
try {
Disconnect-MgGraph -ErrorAction SilentlyContinue
}
catch {
# Negeer disconnect fouten
}
}
}
function Invoke-Revert {
<#
.SYNOPSIS
Draait prompt engineering best practices terug (NIET AANBEVOLEN!)
#>
try {
Write-Host "⚠️ WAARSCHUWING: Terugdraaien van prompt engineering best practices kan leiden tot inefficiënt gebruik!" -ForegroundColor Red
Write-Host "Dit kan leiden tot beveiligingsincidenten, datalekken en niet-naleving van compliance-vereisten.`n" -ForegroundColor Red
Write-Host "[INFO] Terugdraaien van prompt engineering best practices wordt NIET aanbevolen." -ForegroundColor Yellow
Write-Host "Indien nodig, pas individuele best practices aan" -ForegroundColor Yellow
Write-Host "via Microsoft Purview Compliance Portal, Microsoft 365 Admin Center of Microsoft Entra Admin Center." -ForegroundColor Yellow
exit 0
}
catch {
Write-Host "FOUT: $_" -ForegroundColor Red
exit 2
}
}
try {
if ($Revert) {
Invoke-Revert
}
elseif ($Monitoring) {
Invoke-Monitoring
}
elseif ($Remediation) {
Invoke-Remediation
}
else {
Write-Host "Gebruik:" -ForegroundColor Yellow
Write-Host " -Monitoring Controleer of prompt engineering best practices correct zijn geïmplementeerd" -ForegroundColor Gray
Write-Host " -Remediation Herstel ontbrekende of incorrecte best practices (vereist handmatige configuratie)" -ForegroundColor Gray
Write-Host " -Revert Draai best practices terug (NIET AANBEVOLEN!)" -ForegroundColor Red
Write-Host " -WhatIf Toon wat gewijzigd zou worden zonder wijzigingen door te voeren" -ForegroundColor Gray
}
}
catch {
throw
}
finally {
Write-Host "`n========================================`n" -ForegroundColor Cyan
}
Risico zonder implementatie
Risico zonder implementatie
High: Kritiek - Zonder adequate beveiligingsimplementatie voor Microsoft Copilot loopt een organisatie het risico op beveiligingsincidenten, datalekken, niet-naleving van compliance-vereisten en reputatieschade. Voor Nederlandse overheidsorganisaties kan dit leiden tot niet-naleving van BIO-vereisten, AVG-boetes van toezichthouders, NIS2-sancties en verlies van vertrouwen bij burgers.
Management Samenvatting
Implementeer een complete beveiligingsconfiguratie voor Microsoft Copilot in Microsoft 365, inclusief toegangscontrole, data protection, audit logging en compliance-instellingen. Dit waarborgt dat Copilot-gebruik voldoet aan BIO-, AVG- en NIS2-vereisten en dat gevoelige gegevens adequaat worden beschermd tegen beveiligingsbedreigingen.