To find unused named locations in Microsoft Entra ID, list the named locations and the Conditional Access policies, then keep the locations no policy includes or excludes. A policy can name every trusted location at once, so a trusted IP location is in use whenever a policy names all trusted locations. A trusted location also feeds Microsoft's risk calculation, so unused by policies is not always unused.
| Method | Best fit |
|---|---|
| PowerShell | A CSV of the named locations no policy names, with their type and trust. |
| Admin centre | A tenant with a few policies, matched against its locations by eye. |
| Altivane | Recommended for recurring reviews, with every location's policies listed beside it. |
Before you start
Use an account in one of these roles: Security Reader, Global Reader, Security Administrator or Conditional Access Administrator. Named locations are part of Conditional Access, which needs Microsoft Entra ID P1. The PowerShell example requests Policy.; your organisation may require administrator consent.
Know what counts as a use. The examples count a policy in any state, so a location named only by a report-only or off policy is in use. They look at Conditional Access policies only. They read and export; they don't change or delete any location.
Option 1
Find unused named locations with PowerShell
Install the modules once, then connect, read the locations and the policies, and export the locations no policy names.
# Install once, if the modules are not already installed.
Install-Module Microsoft.Graph.Authentication, Microsoft.Graph.Identity.SignIns -Scope CurrentUser$ErrorActionPreference = 'Stop'
Connect-MgGraph -Scopes 'Policy.Read.All' -NoWelcome
try {
$locations = @(Get-MgIdentityConditionalAccessNamedLocation -All)
$policies = @(Get-MgIdentityConditionalAccessPolicy -All)
$named = @($policies | ForEach-Object {
$_.Conditions.Locations.IncludeLocations
$_.Conditions.Locations.ExcludeLocations
})
$report = @(foreach ($location in ($locations | Sort-Object DisplayName)) {
$extra = $location.AdditionalProperties
$type = $extra['@odata.type'] -replace '^#microsoft\.graph\.', ''
$trusted = $type -eq 'ipNamedLocation' -and $extra['isTrusted'] -eq $true
# A policy can name every trusted location at once with AllTrusted.
$allTrusted = $trusted -and $named -contains 'AllTrusted'
if ($allTrusted -or $named -contains $location.Id) { continue }
[pscustomobject]@{
Location = $location.DisplayName
Type = $type
Trusted = $trusted
Created = $location.CreatedDateTime
Modified = $location.ModifiedDateTime
Id = $location.Id
}
})
if ($report.Count -eq 0) {
Write-Output "All $($locations.Count) named locations are used by a policy."
} else {
$report | Export-Csv -Path './unused-named-locations.csv' -NoTypeInformation -Encoding utf8
Write-Output "$($report.Count) of $($locations.Count) named locations are unused."
}
} finally {
Disconnect-MgGraph | Out-Null
}The script gathers every location ID the policies include or exclude, then keeps the locations not among them. Type is ipNamedLocation for IP ranges or countryNamedLocation for countries and regions; only an IP location can be trusted. To count only the policies that are on, add Where-Object { $_. before the ForEach-Object that gathers the IDs.
Option 2
Check named locations in the admin centre
- Sign in to the Microsoft Entra admin centre for the correct tenant.
- Go to Entra ID > Conditional Access > Named locations and note each location.
- Go to Entra ID > Conditional Access > Policies, open each policy and read the Network assignment, formerly Locations, for the locations it includes or excludes.
- Leave each policy without saving. A location that no policy names, directly or as all trusted locations, is unused by policies.
This suits a tenant with a few policies. Matching every location against every policy manually is slow, so for more than a handful, use PowerShell or a report.
Option 3 ยท Recommended for recurring reviews
Report on unused named locations with Altivane
- Open Altivane and choose the tenant.
- Build the tenant's documents with the Named Locations scorecard report in full, so the locations are listed as well as counted.
- Open the tenant's Excel workbook and find the Named Locations Not Used by Any sheet: each location with its type, whether it is trusted, its ranges or countries and when it was last modified.
- Read Named Locations for every location and the policies that use it, each marked include or exclude.
Altivane counts a trusted location as used when a policy names all trusted locations, and counts a policy whatever its state, as the script does. The table goes to the workbook only to start; you can put it in the Word report too.
Contact usCommon questions
Is an unused trusted location safe to delete?
Check first. Sign-ins from trusted named locations improve the accuracy of Microsoft Entra ID Protection's risk calculation, so a trusted location can matter with no policy naming it. Microsoft won't delete a trusted location until you remove its trusted mark, and a deleted location can be restored within 30 days.
Why isn't a location used only by a report-only policy on the list?
The script and Altivane count a policy in any state. A location named only by a policy that is report-only or off has no effect at sign-in yet. To list those policies, see how to find Conditional Access policies not enforced.
What are MFA Trusted IPs in the location list?
They are the trusted IPs from the legacy multifactor authentication service settings, not a named location, and they count as trusted locations in a policy. Microsoft doesn't recommend them, and they accept IPv4 addresses only.
Microsoft references
Technical references checked on 6 November 2026. The example scripts have been reviewed and syntax checked; they have not been run against a live tenant.