Home > OS >  Find ObjectId of a user in Azure without module
Find ObjectId of a user in Azure without module

Time:11-21

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

CodePudding user response:

During my test, you could run the Azure Powershell task with the enter image description here enter image description here

CodePudding user response:

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:

Install-Module AzureAD -Scope CurrentUser
Connect-AzureAD

You can make use of either one of the below commands to retrieve ObjectID:

Get-AzureADUser -ObjectId "XXX@***.onmicrosoft.com"
OR
Get-AzureADUser -Filter "userPrincipalName eq 'XXX@***.onmicrosoft.com'"

Response:

enter image description here

You can make use of Microsoft Graph API to retrieve the Azure AD Users ObjectID:

GET https://graph.microsoft.com/v1.0/users/[email protected]?$select=id

enter image description here

  • Related