Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

Set-EntraNamedLocationPolicy

Updates a named location policy in Microsoft Entra ID by PolicyId.

Syntax

Default (Default)

Set-EntraNamedLocationPolicy

 -PolicyId <String>
 [-OdataType <String>]
 [-IpRanges <System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.IpRange]>]
 [-IncludeUnknownCountriesAndRegions <Boolean>]
 [-IsTrusted <Boolean>]
 [-DisplayName <String>]
 [-Id <String>]
 [-CountriesAndRegions <System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.CountriesAndRegion]>]
 [<CommonParameters>]

Description

This cmdlet allows an admin to update a named location policy in Microsoft Entra ID by PolicyId.

Conditional access policies are custom rules that define an access scenario.

In delegated scenarios with work or school accounts, when acting on another user, the signed-in user must have a supported Microsoft Entra role or custom role with the required permissions. Supported roles include:

  • Security Administrator
  • Conditional Access Administrator

Examples

Example 1: Update an IP named location policy in Microsoft Entra ID by PolicyId

Connect-Entra -Scopes 'Policy.ReadWrite.ConditionalAccess'
$policy = Get-EntraNamedLocationPolicy | Where-Object { "$_.DisplayName -eq 'IP named location policy'" }
$ipRanges = New-Object -TypeName Microsoft.Open.MSGraph.Model.IpRange
$ipRanges.cidrAddress = '6.5.4.3/32'
$type = '#microsoft.graph.ipNamedLocation'
Set-EntraNamedLocationPolicy -PolicyId $policy.Id -OdataType $type -IsTrusted $false -IncludeUnknownCountriesAndRegions $false -IpRanges $ipRanges

This example shows how to update an IP named location policy in Microsoft Entra ID by PolicyId.

  • -PolicyId parameter specifies the Id of a named location policy.
  • -OdataType parameter specifies the odata type of a named location policy.
  • -DisplayName parameter specifies the display name of a named location policy.
  • -IsTrusted parameter specifies the IsTrusted value for the named location policy.
  • -IpRanges parameter specifies List of IP address ranges in IPv4 CIDR format (e.g., 1.2.3.4/32) or any valid IPv6 format as specified in IETF RFC596.

Example 2: Update a country named location policy in Microsoft Entra ID by PolicyId

Connect-Entra -Scopes 'Policy.ReadWrite.ConditionalAccess'
$policy = Get-EntraNamedLocationPolicy | Where-Object { "$_.DisplayName -eq 'IP named location policy'" }
$type = '#microsoft.graph.countryNamedLocation'
Set-EntraNamedLocationPolicy -PolicyId $policy.Id -OdataType $type -IncludeUnknownCountriesAndRegions $true

This command updates a country named location policy in Microsoft Entra ID by PolicyId.

  • -PolicyId parameter specifies the Id of a named location policy.
  • -OdataType parameter specifies the odata type of a named location policy.
  • -IncludeUnknownCountriesAndRegions parameter specifies the includeUnknownCountriesAndRegions value for the named location policy.

Example 3: Update display name of a named location policy in Microsoft Entra ID by PolicyId

Connect-Entra -Scopes 'Policy.ReadWrite.ConditionalAccess'
$policy = Get-EntraNamedLocationPolicy | Where-Object { "$_.DisplayName -eq 'IP named location policy'" }
$type = '#microsoft.graph.ipNamedLocation'
Set-EntraNamedLocationPolicy -PolicyId $policy.Id -OdataType $type -DisplayName 'NewName'

This command updates display name of named location policy in Microsoft Entra ID by PolicyId.

  • -PolicyId parameter specifies the Id of a named location policy.
  • -OdataType parameter specifies the odata type of a named location policy.
  • -DisplayName parameter specifies the display name of a named location policy.

Parameters

-CountriesAndRegions

Specifies the countries and regions for the named location policy in Microsoft Entra ID.

Parameter properties

Type:

System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.CountriesAndRegion]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-DisplayName

Specifies the display name of a named location policy in Microsoft Entra ID.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-Id

Specifies the Id of a named location policy in Microsoft Entra ID.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-IncludeUnknownCountriesAndRegions

Specifies the includeUnknownCountriesAndRegions value for the named location policy in Microsoft Entra ID.

Parameter properties

Type:System.Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-IpRanges

List of IP address ranges in IPv4 CIDR format (e.g., 1.2.3.4/32) or any valid IPv6 format as specified in IETF RFC596. The @odata.type of the ipRange is also required.

Parameter properties

Type:

System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.IpRange]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-IsTrusted

Specifies the IsTrusted value for the named location policy in Microsoft Entra ID.

Parameter properties

Type:System.Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-OdataType

Specifies the OData type of a named location policy object in Microsoft Entra ID.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-PolicyId

Specifies the ID of a named location policy in Microsoft Entra ID.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Related Links


Feedback

Was this page helpful?