Commands › Exchange Online
Set-M365DataAtRestEncryptionPolicy
Modify Microsoft 365 data-at-rest encryption policies in Exchange Online.
Quick start script
# Set-M365DataAtRestEncryptionPolicy — 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-M365DataAtRestEncryptionPolicy
$before | Format-List
# 3. Make the change (dry run first)
Set-M365DataAtRestEncryptionPolicy -AzureKeyIDs <MultiValuedProperty> -Identity <DataEncryptionPolicyIdParameter> -Replace <SwitchParameter> -WhatIf
Set-M365DataAtRestEncryptionPolicy -AzureKeyIDs <MultiValuedProperty> -Identity <DataEncryptionPolicyIdParameter> -Replace <SwitchParameter>
# 4. Verify and diff
$after = Get-M365DataAtRestEncryptionPolicy
Compare-Object ($before | Out-String) ($after | Out-String)
Syntax — 3 parameter sets
TenantAdminPurgeKeyRequest
Set-M365DataAtRestEncryptionPolicy [-Identity] <DataEncryptionPolicyIdParameter> [-Confirm]
[-Description <String>]
[-DomainController <Fqdn>]
[-Enabled <Boolean>]
[-Force]
[-Name <String>]
[-WhatIf]
[<CommonParameters>]
RefreshKey
Set-M365DataAtRestEncryptionPolicy [-Identity] <DataEncryptionPolicyIdParameter> [-Confirm]
[-Description <String>]
[-DomainController <Fqdn>]
[-Enabled <Boolean>]
[-Name <String>]
[-Refresh]
[-WhatIf]
[<CommonParameters>]
ReplaceKey
Set-M365DataAtRestEncryptionPolicy [-Identity] <DataEncryptionPolicyIdParameter> -AzureKeyIDs <MultiValuedProperty> -Replace
[-Confirm]
[-Description <String>]
[-DomainController <Fqdn>]
[-Enabled <Boolean>]
[-Name <String>]
[-WhatIf]
[<CommonParameters>]
Parameters (11)
Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.