List of guest users via microsoft graph - azure-active-directory

I want to get a list of guest users with Microsoft Graph explorer. I've tried with
?$filter -eq usertype
but it seems usertype is not known.
May somebody can help me with this query?

Just use GET https://graph.microsoft.com/v1.0/users?&$filter=userType eq 'Guest' , it works fine on my side.
Note: You need the permission to list users first, refer to this link.

Related

For a Service Principal which permission to give to use command Get-AzNetworkServiceTag?

I create successfully a ServicePrincipal (SP) in AzureAD and able to do a lot of stull like {Connect to Azure, Create resource, etc...}
I need my SP to use command Get-AzNetworkServiceTag but it always return empty values.
When I try command command Get-AzNetworkServiceTag with my own account I get expected result. I believe problem come from permission and your help is very welcome to set least privilege.
My current permissions looks like:
Do you know which one should I use ?
Alternative question is what is best practices to determine permissions based on powershell command ? Although permissions could name to determine there is so many that it's difficult to choose correct one. Thanks you.
The command Get-AzNetworkServiceTag essentially calls the Azure Management REST API - Service Tags - List, it is not related to Azure AD, to solve the issue, you need to assign the Azure RBAC role(not Azure AD admin role) to your service principal.
To solve the issue, the easiest way is to assign the built-in role e.g. Reader, Contributor to your service principal at the subscription scope. But if you want to the
least privilege, your option is to create a custom role then use it, you could follow the steps below.
1.Navigate to your subscription in the portal -> Access control (IAM) -> Add -> Add custom role, follow the screenshots.
Then skip the Permissions, in the JSON, click Edit, add Microsoft.Network/*/read to actions -> Next and create it.
After creating the custom role, wait for a while, navigate to the Access control (IAM) -> add the custom role to your service principal.
In conclusion, the Microsoft.Network/*/read action permission is the least privilege in this case, after giving the role, it will work fine.
Alternative question is what is best practice to determine permissions based on powershell command?
You just need to know what does the command do, then find the operation in the Azure resource provider operations, in this case, there is no such operation like Microsoft.Network/serviceTags/read, so we need to use Microsoft.Network/*/read at least.
You are facing this issue because Powershell cmdlet works differently than compared to MS Graph. Instead of permissions, Powershell require roles to do this operations. Please add Global Administrator role to your service principle and then try the Connect-AzAccount so that, the issue will be fixed.
For more details, you may refer to Assigning administrator roles in Azure Active Directory.

Guest added to Microsoft 365 group through Azure Active Directory PowerShell for Graph module is not able to see Team site

Quick explanation:
We want to add new guests to a Microsoft Team as streamlined as possible. Adding the guest to the M365 group through Powershell seems to work and the guest appears in Team membership, but no URL sent to the guest will get them into the Team channels. They get either an empty Team dashboard (no channels) or "You'll need permissions to access this team or channel", depending on the URL. Deleting the guest from the team and re-adding them through Team admin portal works fine.
Steps to recreate:
Have a team already set up and working, e.g. "MSTeamTest".
Create a CSV in c:\temp called invitations.csv, with the following rows (e.g.):
Name,InvitedUserEmailAddress,TeamName
Test Person, testperson#gmail.com, MSTeamTest
Run these commands in PowerShell (gist):
# Install AzureADPreview
Install-Module AzureADPreview
# Hit UI login for AAD global admin:
Connect-AzureAD
# import CSV
$invitations = import-csv c:\temp\invitations.csv
# Add guest users to AzureAD
$messageInfo = New-Object Microsoft.Open.MSGraph.Model.InvitedUserMessageInfo
$messageInfo.customizedMessageBody = "Hey there! Check this out. I created an invitation through PowerShell"
foreach ($email in $invitations) {New-AzureADMSInvitation -InvitedUserEmailAddress $email.InvitedUserEmailAddress -InvitedUserDisplayName $email.Name -InviteRedirectUrl https://teams.microsoft.com/?tenantid={putIDHere} -InvitedUserMessageInfo $messageInfo -SendInvitationMessage $true}
# Add same guest users to Microsoft 365 Group (same csv)
# wait a few seconds so the new guest user objects are available to add to the group
Start-Sleep -Second 30
foreach ($email in $invitations) {Add-AzureADGroupMember -RefObjectId (Get-AzureADUser | Where { $_.Mail -eq $email.InvitedUserEmailAddress }).ObjectID -ObjectId (Get-AzureADGroup | Where { $_.DisplayName -eq $email.TeamName }).ObjectID}
At this point, assuming this was an entirely new guest, you have rights, licenses, etc., you now have the guest in AzureAD and the guest appears in the Team under: https://admin.teams.microsoft.com/teams/manage/{Teamid}
However, if the person tries to use the web version for https://teams.microsoft.com/?tenantid={putIDHere} they get an empty Teams dashboard (no teams listed).
If you send them a Team link from more>get link to team, and they try something like this: https://teams.microsoft.com/l/team/19%{teamID}%40thread.tacv2/conversations?groupId={groupID}&tenantId={tenantID} they get:
"You'll need permissions to access this team or channel. Try contacting the team owner or admin."
And the same behavior happens if they follow a link like this: https://myapps.microsoft.com/?tenantid={tenantID} - they see they are a member of the "MSTeamTest" group with no apps. Clicking the group lets them launch Teams, but they get the same "You'll need permissions" dialog.
And again - through the admin panel, the person looks to be part of membership. For an existing member they see the person listed as a guest on the Team. It's almost like I'm missing one powershell command.
Why am I doing this at all?
The process is too cluttered if the end goal is to just get a guest up and running in Teams. Two emails with manual intervention in between is confusing to the guests (one for AAD, one for Teams)
AzureAD B2B lets you create a guest and make them a member of a group at the same time, but for bulk import in the UI with a CSV of new guest users, it does not let you add membership to a group (aka the Team in question), so I've turned to PowerShell.
I know folks say it takes a while for things to propagate:
https://techcommunity.microsoft.com/t5/microsoft-teams/teams-membership-and-groups-membership/m-p/92982
however this does not seem to be the issue.
If you have any thoughts or a solution I'd be grateful! Thanks!
FYI, please be aware that when you add users to a o365 group through powershell or teams, it can take up to 24 hours to sync with teams backend and to fully provision the users. they are actually 2 separate datasets, where the o365 membership needs to be synced to the teams data on the microsoft backend. so there are chances where you will see inconsistencies up to 24 hours. it's not a real-time operation.
The issues have been made worse with all the covid- work from home situation because teams is seeing such a massive spike of users.
But if you notice inconsistencies, that is usually the reason, especially if you added users through powershell or even more so through graph api.
The order of operation that seems to work seems to be:
Add the user to the AzureAD using: New-AzureADMSInvitation
Wait (e.g.) 30 seconds: Start-Sleep -Second 30
Add user to Microsoft 365 group using: Add-TeamUser
Notes:
Step #3 is part of Install-Module -Name MicrosoftTeams. Email for the Team seems to be sent ~10-15 minutes after the initial invite. The Microsoft Team email has a SharePoint link, and if you go into the documents there, you will eventually see a link to open the Team channel. So far this seems to be working, albeit with the delays mentioned.

Microsoft Graph Explorer Check if user is mailenabled

i try to find a query to check which AAD users are mail enabled.
I think with PowerShell checking the users mailbox will work (attribute ismailenabled), but i cant find something equal in the Microsoft Graph documentation.
Any ideas how i can get a list of mailenabled users in graph explorer?
BR
Thomas
There is no mailenabled property for user in the Microsoft Graph API. For the all properties of user, please read here.

wso2 api manager 1.6.0 problems with User store management using ActiveDirectoryUserStoreManager

I'm trying to setup a ActiveDirectoryUserStoreManager as a secondary user store. But I cannot seem to get the Role assignment of users correct.
What I have done so far:
- Made the AD ldap-connection
- Retrieved the users from the AD
- Retrieved the roles from the AD
- Can view Users that are connected to a specific role in API Manager Gui
My problem:
When I go to a user and click "View Roles" in the API Manager Gui ({IP}:9443/carbon/user/user-mgt.jsp) I get a "No matching roles found" dialog. But when I go to a Role ({IP}:9443/carbon/role/role-mgt.jsp) and click "View Users" I can see that the user I "View Roles" of above is actually in that role.
So obviously I have some sort of miss connection between the Users that are connected to Roles and the Roles that are connected to a User. I just cannot figure out where I'm getting it wrong.
If anyone would give me any hint or even ask a question about something I haven't already tried that would be awesome!
Seems to be a problem with your RoleDNPattern. You can first try by commenting it and see if it resolves the problem. If it does, then have to compose the correct query for that.

Can we get member list from a created google group using AdminSDK without super user's right

As mentioned in the title, Is there anybody know how to get member list belong to a created google group using AdminSDK without super user's right. I tried on GAE but always received the following error :
「Not Authorized to access this resource/api」
Thank you!
You dont need superuser rights, thats just one way.
If the user is owner/manager of the group, she can see membership.
Also might work if you make group membership visible to all but i haven't tried it.

Resources