Hi Todd,
The only way I can think of doing it is to automate this with either Azure Automation (that triggers a PowerShell script) or to run the PowerShell script locally through a scheduled function on the server.
#1 The script should make use of Get-ADAzureADGroup:
Get-AzureADGroupMember -ObjectId "YourGroupID" -All $true
#2 Then, you would want to loop through each object and add them to the local RDP group:
Add-LocalGroupMember -Group "Remote Desktop Users" -Member $object
#3 The final script should look something like:
# Get all members of the Azure AD group
$azureADGroupMembers = Get-AzureADGroupMember -ObjectId "YourGroupID" -All $true
# Loop through each member and add them to the "Remote Desktop Users" group
foreach ($member in $azureADGroupMembers) {
$userPrincipalName = $member.UserPrincipalName
# Add the user to the "Remote Desktop Users" group
Add-LocalGroupMember -Group "Remote Desktop Users" -Member "AzureAD\$userPrincipalName"
Write-Host "Added $userPrincipalName to Remote Desktop Users group."
}
If this is helpful please accept answer.