Edit

Share via


Get-EntraNamedLocationPolicy

Gets a Microsoft Entra ID named location policy.

Syntax

GetQuery (Default)

Get-EntraNamedLocationPolicy

    [-Property <String[]>]
    [<CommonParameters>]

GetById

Get-EntraNamedLocationPolicy

    -PolicyId <String>
    [-Property <String[]>]
    [<CommonParameters>]

Description

This cmdlet allows an admin to get the Microsoft Entra ID named location policies.

Named locations are custom rules that define network locations, which can then be used in a Conditional Access policy.

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. The least privileged roles for this operation are:

  • Global Secure Access Administrator (read-only standard properties)
  • Security Reader (read-only standard properties)
  • Security Administrator (read-only standard properties)
  • Global Reader
  • Conditional Access Administrator

Examples

Example 1: Retrieves a list of all named location policies in Microsoft Entra ID

Connect-Entra -Scopes 'Policy.Read.All'
Get-EntraNamedLocationPolicy
Id                                   CreatedDateTime      DisplayName    ModifiedDateTime
--                                   ---------------      -----------    ----------------
dddddddd-3333-4444-5555-eeeeeeeeeeee 31/07/2024 9:53:10   NamedLocation   31/07/2024 9:53:10
eeeeeeee-4444-5555-6666-ffffffffffff 31/07/2024 4:38:42   NamedLocation1  31/07/2024 4:38:42
ffffffff-5555-6666-7777-aaaaaaaaaaaa 01/08/2024 4:39:42   NamedLocation2  01/08/2024 4:39:42
aaaaaaaa-6666-7777-8888-bbbbbbbbbbbb 01/08/2024 4:57:03   NamedLocation3  01/08/2024 4:57:03

This command retrieves a list of all named location policies in Microsoft Entra ID.

Example 2: Retrieves a named location policy by Id

Connect-Entra -Scopes 'Policy.Read.All'
$policy = Get-EntraNamedLocationPolicy | Where-Object { $_.DisplayName -eq 'Provisioning Workers' }
Get-EntraNamedLocationPolicy -PolicyId $policy.Id
Id                                   CreatedDateTime      DisplayName    ModifiedDateTime
--                                   ---------------      -----------    ----------------
dddddddd-3333-4444-5555-eeeeeeeeeeee 3/1/2024 9:53:10 AM  NamedLocation  3/1/2024 9:53:10 AM

This example retrieves a specified named location policy in Microsoft Entra ID.

  • -PolicyId parameter specifies the policy Id of a named location policy.

Parameters

-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

GetById
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-Property

Specifies properties to be returned.

Parameter properties

Type:

System.String[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:Select

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

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.