Commands › Exchange Online

New-SafeLinksPolicy

Exchange Online ExchangeOnlineManagement New-*

Create Safe Links policies in your cloud-based organization.

Quick start script

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

# 3. Make the change (dry run first)
New-SafeLinksPolicy -Name <String> -WhatIf
New-SafeLinksPolicy -Name <String>

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

Syntax

New-SafeLinksPolicy [-Name] <String>
 [-AdminDisplayName <String>]
 [-AllowClickThrough <Boolean>]
 [-Confirm]
 [-CustomNotificationText <String>]
 [-DeliverMessageAfterScan <Boolean>]
 [-DisableUrlRewrite <Boolean>]
 [-DoNotRewriteUrls <MultiValuedProperty>]
 [-EnableForInternalSenders <Boolean>]
 [-EnableOrganizationBranding <Boolean>]
 [-EnableSafeLinksForEmail <Boolean>]
 [-EnableSafeLinksForOffice <Boolean>]
 [-EnableSafeLinksForTeams <Boolean>]
 [-MakeBuiltInProtection]
 [-RecommendedPolicyType <RecommendedPolicyType>]
 [-ScanUrls <Boolean>]
 [-TrackClicks <Boolean>]
 [-UseTranslatedNotificationText <Boolean>]
 [-WhatIf]
 [<CommonParameters>]

Parameters (19)

ParameterTypeRequiredWhat it controls
-Name String yes The Name parameter specifies a unique name for the Safe Links policy. If the value contains spaces, enclose the value in quotation marks (").
-AdminDisplayName String The AdminDisplayName parameter specifies a description for the policy. If the value contains spaces, enclose the value in quotation marks (").
-AllowClickThrough Boolean The AllowClickThrough parameter specifies whether users are allowed to click through to the original URL on warning pages. Valid values 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.
-CustomNotificationText String The custom notification text specifies the customized notification text to show to users. If the value contains spaces, enclose the value in quotation marks (").
-DeliverMessageAfterScan Boolean The DeliverMessageAfterScan parameter specifies whether to deliver email messages only after Safe Links scanning is complete. Valid values are:
-DisableUrlRewrite Boolean The DisableUrlRewrite parameter specifies whether to rewrite (wrap) URLs in email messages. Valid values are:
-DoNotRewriteUrls MultiValuedProperty The DoNotRewriteUrls parameter specifies the URLs that are not rewritten by Safe Links scanning. The list of entries allows users who are included in the policy to access the specified URLs that would otherwise be...
-EnableForInternalSenders Boolean The EnableForInternalSenders parameter specifies whether the Safe Links policy is applied to messages sent between internal senders and internal recipients within the same Exchange Online organization. Valid values are:
-EnableOrganizationBranding Boolean The EnableOrganizationBranding parameter specifies whether your organization's logo is displayed on Safe Links warning and notification pages. Valid values are:
-EnableSafeLinksForEmail Boolean The EnableSafeLinksForEmail parameter specifies whether to enable Safe Links protection for email messages. Valid values are:
-EnableSafeLinksForOffice Boolean The EnableSafeLinksForOffice parameter specifies whether to enable Safe Links protection for supported Office desktop, mobile, or web apps. Valid values are:
-EnableSafeLinksForTeams Boolean The EnableSafeLinksForTeams parameter specifies whether Safe Links is enabled for Microsoft Teams. Valid values are:
-MakeBuiltInProtection SwitchParameter The MakeBuiltInProtection switch is used for Built-in protection policy creation as part of [Preset security policies](https://learn.microsoft.com/defender-office-365/preset-security-policies). Don't use this switch yourself.
-RecommendedPolicyType RecommendedPolicyType The RecommendedPolicyType parameter is used for Standard and Strict policy creation as part of [Preset security policies](https://learn.microsoft.com/defender-office-365/preset-security-policies). Don't use this...
-ScanUrls Boolean The ScanUrls parameter specifies whether to enable or disable real-time scanning of clicked links in email messages. Valid values are:
-TrackClicks Boolean The TrackClicks parameter specifies whether to track user clicks related to Safe Links protection of links. Valid values are:
-UseTranslatedNotificationText Boolean The UseTranslatedNotificationText specifies whether to use Microsoft Translator to automatically localize the custom notification text that you specified with the CustomNotificationText parameter. Valid values are:
-WhatIf SwitchParameter The WhatIf switch shows what the command does without making any changes. You don't need to specify a value with this switch.

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