简体   繁体   English

Mac 上的 AzureAD Powershell

[英]AzureAD Powershell on Mac

using Powershell I am trying to retrieve information such as EmployeeID, Manager, Job Title etc, but I am only able to get basic information.使用 Powershell 我试图检索诸如 EmployeeID、Manager、Job Title 等信息,但我只能获取基本信息。 Can anyone please help me?谁能帮帮我吗?

Once I have connected to Azure using the following:使用以下命令连接到 Azure 后:

connect-azaccount -TenantId 'b4a42f9f-57e8-4535-80d8-2ff03a6240f8'

I then type然后我输入

Get-AzADUser -ObjectId 2a6aa9b5-1519-480c-9014-57296457a21c

which returns the following:返回以下内容:

UserPrincipalName : joy.mia@lts.onmicrosoft.com
ObjectType        : User
UsageLocation     : GB
GivenName         : Joyn
Surname           : Miah
AccountEnabled    : True
MailNickname      : joy.mia
Mail              : 
DisplayName       : Joy Mia
Id                : 2a6aa9b5-1519-480c-9014-57296457a21c
Type              : Member

Is it possible to retrieve information im looking for?是否可以检索我正在寻找的信息? Many Thanks in Advance提前谢谢了

Get-AzUser doesn't return more than that, but you can get the information from the CmdLets Get-AzureADUser and Get-AzureADUserManager , both from the Graph-based AzureAD module ( https://docs.microsoft.com/en-us/powershell/module/azuread/?view=azureadps-2.0 ). Get-AzUser不会返回更多信息,但您可以从 CmdLets Get-AzureADUserGet-AzureADUserManager ,两者都来自基于图形的AzureAD模块 ( https://docs.microsoft.com/en-us /powershell/module/azuread/?view=azureadps-2.0 )。

EmployeeId is hidden in "ExtensionProperty" and the Manager needs a separate command. EmployeeId 隐藏在“ExtensionProperty”中,Manager 需要一个单独的命令。 If you want them listed as normal attributes you can use calculated properties like this:如果您希望它们被列为普通属性,您可以使用这样的计算属性:

Get-AzureADUser -ObjectId 8527a585-7692-4fa8-9db4-ba3c4946a890 |
    Select-Object *,
        @{n='EmployeeId';e={$_.ExtensionProperty.employeeId}},
        @{n='Manager';e={ (Get-AzureADUserManager -ObjectId $_.ObjectId).DisplayName }}

You'll need to connect first using Connect-AzureAD .您需要先使用Connect-AzureAD进行Connect-AzureAD

If you want the UPN of the Manager instead just change "DisplayName" to "UserPrincipalName"如果您想要 Manager 的 UPN,只需将“DisplayName”更改为“UserPrincipalName”

With the command above, you'll get all these (apart from EmployeeId and Manager):使用上面的命令,您将获得所有这些(除了 EmployeeId 和 Manager):

ExtensionProperty
DeletionTimestamp
ObjectId
ObjectType
AccountEnabled
AgeGroup
AssignedLicenses
AssignedPlans
City
CompanyName
ConsentProvidedForMinor
Country
CreationType
Department
DirSyncEnabled
DisplayName
FacsimileTelephoneNumber
GivenName
IsCompromised
ImmutableId
JobTitle
LastDirSyncTime
LegalAgeGroupClassification
Mail
MailNickName
Mobile
OnPremisesSecurityIdentifier
OtherMails
PasswordPolicies
PasswordProfile
PhysicalDeliveryOfficeName
PostalCode
PreferredLanguage
ProvisionedPlans
ProvisioningErrors
ProxyAddresses
RefreshTokensValidFromDateTime
ShowInAddressList
SignInNames
SipProxyAddress
State
StreetAddress
Surname
TelephoneNumber
UsageLocation
UserPrincipalName
UserState
UserStateChangedOn
UserType

PMental's response is probably correct. Pmental 的回答可能是正确的。 (I couldn't confirm because the Get-AzureADUser CmdLet is not available on my machine.) Swapping his Get-AzureADUser for Get-AzUser worked fine: (我无法确认,因为 Get-AzureADUser CmdLet 在我的机器上不可用。)将他的 Get-AzureADUser 交换为 Get-AzUser 工作正常:

Get-AzADUser -ObjectId 8527a585-7692-4fa8-9db4-ba3c4946a890 |
    Select-Object *,
        @{n='EmployeeId';e={$_.ExtensionProperty.employeeId}},
        @{n='Manager';e={ (Get-AzureADUserManager -ObjectId $_.ObjectId).DisplayName }}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM