ユーザに割り当てたカスタムセキュリティ属性をPowerShell から確認したいと考えています。
以下を参考にユーザーからカスタム セキュリティ属性の割り当てを取得しようとしていますが、"customSecurityAttributes"の値が取得できず空白になってしまいます。
https://learn.microsoft.com/ja-jp/entra/identity/users/users-custom-security-attributes?tabs=ms-powershell
Connect-MgGraph -Scopes "User.Read.All"
$userAttributes = Get-MgUser -UserId $userId -Property "customSecurityAttributes"
$userAttributes
DisplayName Id Mail UserPrincipalName
----------- -- ---- -----------------
実行ユーザには、グローバル管理者のみでなく属性定義閲覧者・属性割り当て管理者などカスタムセキュリティ属性関連のロールも付与しています。
Get-MgUserモジュールと Format-List コマンドレットを利用しCustomSecurityAttributes を確認すると、設定内容ではなく"Microsoft.Graph.PowerShell.Models.MicrosoftGraphCustomSecurityAttributeValue"という内容が表示されます。
Get-MgUser -UserId $userId | Format-List "CustomSecurityAttributes"
CustomSecurityAttributes : Microsoft.Graph.PowerShell.Models.MicrosoftGraphCustomSecurityAttributeValue