Commands › Exchange Online

New-DeviceTenantRule

Exchange Online ExchangeOnlineManagement New-*

For more information, see Security & Compliance PowerShell. Use the New-DeviceTenantRule cmdlet to create your organization's mobile device tenant rule in Basic Mobility and Security in Microsoft 365.

Quick start script

# New-DeviceTenantRule — 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-DeviceTenantRule
$before | Format-List

# 3. Make the change (dry run first)
New-DeviceTenantRule  -WhatIf
New-DeviceTenantRule

# 4. Verify and diff
$after = Get-DeviceTenantRule
Compare-Object ($before | Out-String) ($after | Out-String)

Syntax

New-DeviceTenantRule [-ApplyPolicyTo <PolicyResourceScope>]
 [-BlockUnsupportedDevices <Boolean>]
 [-Confirm]
 [-DomainController <Fqdn>]
 [-ExclusionList <MultiValuedProperty>]
 [-WhatIf]
 [<CommonParameters>]

Parameters (6)

ParameterTypeRequiredWhat it controls
-ApplyPolicyTo PolicyResourceScope The ApplyPolicyTo parameter specifies where to apply the policy in your organization. Valid values for this parameter are:
-BlockUnsupportedDevices Boolean The BlockUnsupportedDevices parameter specifies whether to block access to your organization by unsupported devices. Valid values for this parameter are:
-Confirm SwitchParameter The Confirm switch specifies whether to show or hide the confirmation prompt. How this switch affects the cmdlet depends on whether the cmdlet requires confirmation before proceeding.
-DomainController Fqdn This parameter is reserved for internal Microsoft use.
-ExclusionList MultiValuedProperty The ExclusionList parameter specifies the security groups to exclude from this policy. Members of the specified security groups who have non-compliant devices are not affected by block access actions.
-WhatIf SwitchParameter The WhatIf switch doesn't work in Security & Compliance PowerShell.

Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.