繁体   English   中英

Mac 上的 AzureAD Powershell

[英]AzureAD Powershell on Mac

使用 Powershell 我试图检索诸如 EmployeeID、Manager、Job Title 等信息,但我只能获取基本信息。 谁能帮帮我吗?

使用以下命令连接到 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不会返回更多信息,但您可以从 CmdLets Get-AzureADUserGet-AzureADUserManager ,两者都来自基于图形的AzureAD模块 ( https://docs.microsoft.com/en-us /powershell/module/azuread/?view=azureadps-2.0 )。

EmployeeId 隐藏在“ExtensionProperty”中,Manager 需要一个单独的命令。 如果您希望它们被列为普通属性,您可以使用这样的计算属性:

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进行Connect-AzureAD

如果您想要 Manager 的 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

Pmental 的回答可能是正确的。 (我无法确认,因为 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