This issue bugged me some time, but since we do not often apply the DSC, it was not that much annoying. But our NamedLocations get created with every release.
We are using the same DisplayName, and even provide the ID of the NamedLocations. I found out, that the get-resource always writes out:
Could not retrieve AAD Named Location by ID {0b3c94ad-1529-4cf3-92f3-90f3cc7125b9}
But when I do the same command in PowerShell, I do get my Named Location:
Get-MgBetaIdentityConditionalAccessNamedLocation -NamedLocationId 0b3c94ad-1529-4cf3-92f3-90f3cc7125b9
I could not further pin down, where the Issue might arise.
Could not retrieve AAD Named Location by ID {0b3c94ad-1529-4cf3-92f3-90f3cc7125b9}
Eventlog:
Error retrieving data: { One or more errors occurred. } \ at Get-MgBetaIdentityConditionalAccessNamedLocation<Begin>, C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Beta.Identity.SignIns\2.17.0\exports\ProxyCmdletDefinitions.ps1: line 18864 \ at Get-TargetResource, D:\a\r1\a\_KTSG\drop\s\Modules\Microsoft365DSC\1.24.417.1\DscResources\MSFT_AADNamedLocationPolicy\MSFT_AADNamedLocationPolicy.psm1: line 107 \ at Set-TargetResource, D:\a\r1\a\_KTSG\drop\s\Modules\Microsoft365DSC\1.24.417.1\DscResources\MSFT_AADNamedLocationPolicy\MSFT_AADNamedLocationPolicy.psm1: line 246 TenantId: -radacted-.onmicrosoft.com
Well, today it worked for the first time. The locations does not get recreated again. I'm not sure, why, and how, but maybe some voodoo, and the release must be rolled two times, that it works.
Description of the issue
This issue bugged me some time, but since we do not often apply the DSC, it was not that much annoying. But our NamedLocations get created with every release. We are using the same DisplayName, and even provide the ID of the NamedLocations. I found out, that the get-resource always writes out: Could not retrieve AAD Named Location by ID {0b3c94ad-1529-4cf3-92f3-90f3cc7125b9} But when I do the same command in PowerShell, I do get my Named Location: Get-MgBetaIdentityConditionalAccessNamedLocation -NamedLocationId 0b3c94ad-1529-4cf3-92f3-90f3cc7125b9
I could not further pin down, where the Issue might arise.
Microsoft 365 DSC Version
1.24.417.1
Which workloads are affected
Azure Active Directory (Entra ID)
The DSC configuration
Verbose logs showing the problem
Environment Information + PowerShell Version