You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Parameter(Mandatory=$true,Position=0,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,HelpMessage='The unique identifier for the user (User Principal Name or UserId).')]
# Create a descriptive name for the certificate type
71
+
$typeName=switch ($type) {
72
+
"PN" { "PrincipalName" }
73
+
"S" { "Subject" }
74
+
"I" { "Issuer" }
75
+
"SR" { "SerialNumber" }
76
+
"SKI" { "SubjectKeyIdentifier" }
77
+
"SHA1-PUKEY" { "SHA1PublicKey" }
78
+
default { $type }
79
+
}
80
+
81
+
$certificateUserIds+= [PSCustomObject]@{
82
+
Type=$type
83
+
TypeName=$typeName
84
+
Value=$value
85
+
OriginalString=$certId
86
+
}
87
+
}
88
+
else {
89
+
# For any ID that doesn't match the expected format
90
+
$certificateUserIds+= [PSCustomObject]@{
91
+
Type="Unknown"
92
+
TypeName="Unknown"
93
+
Value=$certId
94
+
OriginalString=$certId
95
+
}
96
+
}
97
+
}
98
+
}
99
+
100
+
# Create a structured AuthorizationInfo object
101
+
$authInfo= [PSCustomObject]@{
102
+
CertificateUserIds=$certificateUserIds
103
+
RawAuthorizationInfo=$response.authorizationInfo
104
+
}
105
+
106
+
# Create a custom output object with the properties of interest
107
+
$result= [PSCustomObject]@{
108
+
Id=$response.id
109
+
DisplayName=$response.displayName
110
+
UserPrincipalName=$response.userPrincipalName
111
+
UserType=$response.userType
112
+
AuthorizationInfo=$authInfo
113
+
}
114
+
115
+
return$result
116
+
}
117
+
catch {
118
+
$errorDetails=$_.Exception.Message
119
+
Write-Error"Failed to retrieve authorization info: $errorDetails"
120
+
throw
121
+
}
122
+
}
123
+
124
+
end {
125
+
# Cleanup if needed
126
+
}
127
+
}
128
+
129
+
Set-Alias-Name Get-EntraUserAuthorizationInfo-Value Get-EntraUserCBAAuthorizationInfo-Description "Gets a user's authorization information from Microsoft Entra ID"-Scope Global -Force
0 commit comments