We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code below assumes the principal was found with one of the 3 attempts. However, there needs to be a check if $PrincipalValue is still null.
Write-Verbose -Message 'Getting Role Eligibility by PrincipalId and RoleDefinitionId' $PrincipalValue = $null if ($PrincipalType -eq 'User') { Write-Verbose -Message "Retrieving Principal by UserPrincipalName {$Principal}" $PrincipalInstance = Get-MgUser -Filter "UserPrincipalName eq '$Principal'" -ErrorAction SilentlyContinue $PrincipalValue = $PrincipalInstance.UserPrincipalName } elseif ($null -eq $PrincipalIdValue -and $PrincipalType -eq 'Group') { Write-Verbose -Message "Retrieving Principal by DisplayName {$Principal}" $PrincipalInstance = Get-MgGroup -Filter "DisplayName eq '$Principal'" -ErrorAction SilentlyContinue $PrincipalValue = $PrincipalInstance.DisplayName } else { Write-Verbose -Message "Retrieving Principal by DisplayName {$Principal}" $PrincipalInstance = Get-MgServicePrincipal -Filter "DisplayName eq '$Principal'" -ErrorAction SilentlyContinue $PrincipalValue = $PrincipalInstance.DisplayName } Write-Verbose -Message 'Found Principal'
Write-Verbose -Message 'Getting Role Eligibility by PrincipalId and RoleDefinitionId' $PrincipalValue = $null if ($PrincipalType -eq 'User') { Write-Verbose -Message "Retrieving Principal by UserPrincipalName {$Principal}" $PrincipalInstance = Get-MgUser -Filter "UserPrincipalName eq '$Principal'" -ErrorAction SilentlyContinue $PrincipalValue = $PrincipalInstance.UserPrincipalName } elseif ($null -eq $PrincipalIdValue -and $PrincipalType -eq 'Group') { Write-Verbose -Message "Retrieving Principal by DisplayName {$Principal}" $PrincipalInstance = Get-MgGroup -Filter "DisplayName eq '$Principal'" -ErrorAction SilentlyContinue $PrincipalValue = $PrincipalInstance.DisplayName } else { Write-Verbose -Message "Retrieving Principal by DisplayName {$Principal}" $PrincipalInstance = Get-MgServicePrincipal -Filter "DisplayName eq '$Principal'" -ErrorAction SilentlyContinue $PrincipalValue = $PrincipalInstance.DisplayName }
Write-Verbose -Message 'Found Principal'
DEV
Azure Active Directory (Entra ID)
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Description of the issue
Code below assumes the principal was found with one of the 3 attempts. However, there needs to be a check if $PrincipalValue is still null.
Microsoft 365 DSC Version
DEV
Which workloads are affected
Azure Active Directory (Entra ID)
The DSC configuration
Verbose logs showing the problem
Environment Information + PowerShell Version
The text was updated successfully, but these errors were encountered: