Commands › Exchange Online
Set-DataEncryptionPolicy
Modify data encryption policies in Exchange Online.
Quick start script
# Set-DataEncryptionPolicy — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-ExchangeOnline -CertificateThumbprint $thumb -AppId $appId -Organization $org
# 2. Capture the current state first — you cannot roll back what you never recorded
$before = Get-DataEncryptionPolicy
$before | Format-List
# 3. Make the change (dry run first)
Set-DataEncryptionPolicy -AzureKeyIDs <MultiValuedProperty> -Identity <DataEncryptionPolicyIdParameter> -PermanentDataPurgeContact <String> -WhatIf
Set-DataEncryptionPolicy -AzureKeyIDs <MultiValuedProperty> -Identity <DataEncryptionPolicyIdParameter> -PermanentDataPurgeContact <String>
# 4. Verify and diff
$after = Get-DataEncryptionPolicy
Compare-Object ($before | Out-String) ($after | Out-String)
Syntax — 4 parameter sets
DCAdminPurgeKeyRequest
Set-DataEncryptionPolicy [-Identity] <DataEncryptionPolicyIdParameter> -PermanentDataPurgeReason <String> [-PermanentDataPurgeContact <String>]
[-Confirm]
[-Description <String>]
[-DomainController <Fqdn>]
[-Enabled <Boolean>]
[-Force]
[-Name <String>]
[-WhatIf]
[<CommonParameters>]
TenantAdminPurgeKeyRequest
Set-DataEncryptionPolicy [-Identity] <DataEncryptionPolicyIdParameter> -PermanentDataPurgeContact <String> -PermanentDataPurgeReason <String>
[-PermanentDataPurgeRequested]
[-Confirm]
[-Description <String>]
[-DomainController <Fqdn>]
[-Enabled <Boolean>]
[-Force]
[-Name <String>]
[-WhatIf]
[<CommonParameters>]
RefreshKey
Set-DataEncryptionPolicy [-Identity] <DataEncryptionPolicyIdParameter>
[-Refresh]
[-Confirm]
[-Description <String>]
[-DomainController <Fqdn>]
[-Enabled <Boolean>]
[-Name <String>]
[-WhatIf]
[<CommonParameters>]
ReplaceKey
Set-DataEncryptionPolicy [-Identity] <DataEncryptionPolicyIdParameter> -AzureKeyIDs <MultiValuedProperty> -Replace
[-Confirm]
[-Description <String>]
[-DomainController <Fqdn>]
[-Enabled <Boolean>]
[-Name <String>]
[-WhatIf]
[<CommonParameters>]
Parameters (14)
Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.