I want to find ObjectId of a user, but I can’t use Get-AzADUser module as I don’t have privilege to install this module.
Get-AzRoleAssignment, Get-AzContext is accessible to me
Is there any other way to find ObjectId of a user with any other module.
Any help would be GREATLY appreciated
2
Answers
During my test, you could run the Azure Powershell task with the command
Get-AzADUser -DisplayName <String>
to query the oid.================================================================
Update on 11/22
You could also test to use the az command of
az ad user list [--display-name]
with local cli.And it could also be put in Azure DevOps pipeline.
I agree with Ceeno Qi-MSFT. Alternatively, you can also use below approach:
I tried to reproduce the same environment and got the below results:
To get the ObjectId of a user in Azure, you can make use of
AzureAD
module:You can make use of either one of the below commands to retrieve ObjectID:
Response:
You can make use of Microsoft Graph API to retrieve the Azure AD Users ObjectID: