The Get-MgIdentityConditionalAccessNamedLocation cmdlet retrieves named locations defined for conditional access in Microsoft Entra ID (previously Azure AD). Named locations help you specify trusted IP ranges or countries for use in security policies.
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "Policy.Read.All"
Run the Graph PowerShell command below to list all named locations used in conditional access. This retrieves all named locations defined in your tenant:
Get-MgIdentityConditionalAccessNamedLocation
This Graph PowerShell command displays detailed information for a specific location:
Get-MgIdentityConditionalAccessNamedLocation -NamedLocationId "location-id"
This Graph PowerShell command command filters to show only the country and displayName properties for all named locations:
Get-MgIdentityConditionalAccessNamedLocation | Select-Object displayName, countriesAndRegions
The following are some essential parameters that can be used along with the Get-MgIdentityConditionalAccessNamedLocation command:
| Parameters | Description |
|---|---|
| -NamedLocationId | The unique ID of a specific named location |
| -Top | Limits the number of results |
| -Filter | Returns only locations matching a specified filter |
| -All | Retrieves all results without paging |
| -Property | Specifies properties to display |
ADManager Plus, an identity governance and administration solution with comprehensive Microsoft Entra ID management and reporting capabilities, simplifies complex admin tasks from a single, user-friendly console: