AzureAD Powershell on Mac



使用Powershell,我试图检索EmployeeID、经理、职位等信息,但我只能获得基本信息。有人能帮我吗?

一旦我使用以下方法连接到Azure:

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

然后我键入

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

返回以下内容:

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

有可能检索我想要的信息吗?提前感谢

Get-AzUser不会返回更多信息,但您可以从CmdLetsGet-AzureADUserGet-AzureADUserManager获取信息,这两个信息都来自基于Graph的AzureAD模块(https://learn.microsoft.com/en-us/powershell/module/azuread/?view=azureadps-2.0(.

EmployeeId隐藏在";ExtensionProperty";并且管理器需要一个单独的命令。如果你想把它们列为正常属性,你可以使用这样的计算属性:

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

您需要先使用Connect-AzureAD进行连接。

如果你想要管理器的UPN而只是改变";DisplayName";至";UserPrincipalName";

使用上面的命令,您将获得所有这些(除了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

最新更新