Commands › Exchange Online

New-SharingPolicy

Exchange Online ExchangeOnlineManagement New-*

Create a sharing policy to regulate how users inside your organization can share calendar and contact information with users outside the organization. Users can only share this information after federation is configured in Exchange. After federation is configured, users can send sharing invitations that comply with a sharing policy to external recipients in other Exchange Server 2010 or later organizations that have federation enabled. A sharing policy needs to get assigned to a mailbox to be effective. If a mailbox doesn't have a specific sharing policy assigned, a default policy enforces the

Quick start script

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

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

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

Syntax

New-SharingPolicy [-Name] <String> -Domains <MultiValuedProperty>
 [-Confirm]
 [-Default]
 [-DomainController <Fqdn>]
 [-Enabled <Boolean>]
 [-WhatIf]
 [<CommonParameters>]

Parameters (7)

ParameterTypeRequiredWhat it controls
-Name String yes The Name parameter specifies the name of the new sharing policy.
-Domains MultiValuedProperty yes The Domains parameter specifies the domains and the associated sharing options for those domains in the sharing policy. Values for this parameter use the basic syntax: `'Domain: SharingPolicyAction'`.
-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.
-Default SwitchParameter The Default switch specifies that this sharing policy is the default sharing policy for all mailboxes. You don't need to specify a value with this switch.
-DomainController Fqdn This parameter is available only in on-premises Exchange.
-Enabled Boolean The Enabled parameter specifies whether to enable the new sharing policy. Valid input for this parameter is $true or $false. The default is $true.
-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.