File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
Entrypoints/HTTP Functions/Identity/Administration/Users Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -19,17 +19,28 @@ Function Invoke-ExecCreateTAP {
1919 $UserID = $Request.Query.ID ?? $Request.Body.ID
2020
2121 try {
22- $Result = New-CIPPTAP - userid $UserID - TenantFilter $TenantFilter - APIName $APIName - Headers $Headers
22+ $TAPResult = New-CIPPTAP - userid $UserID - TenantFilter $TenantFilter - APIName $APIName - Headers $Headers
23+
24+ # Create results array with both TAP and UserID as separate items
25+ $Results = @ (
26+ $TAPResult ,
27+ @ {
28+ resultText = " User ID: $UserID "
29+ copyField = $UserID
30+ state = ' success'
31+ }
32+ )
33+
2334 $StatusCode = [HttpStatusCode ]::OK
2435 } catch {
25- $Result = Get-NormalizedError - message $ ($_.Exception.Message )
36+ $Results = Get-NormalizedError - message $ ($_.Exception.Message )
2637 $StatusCode = [HttpStatusCode ]::InternalServerError
2738 }
2839
2940 # Associate values to output bindings by calling 'Push-OutputBinding'.
3041 Push-OutputBinding - Name Response - Value ([HttpResponseContext ]@ {
3142 StatusCode = $StatusCode
32- Body = @ {' Results' = $Result }
43+ Body = @ {' Results' = $Results }
3344 })
3445
3546}
Original file line number Diff line number Diff line change @@ -11,7 +11,8 @@ function New-CIPPTAP {
1111 $GraphRequest = New-GraphPostRequest - uri " https://graph.microsoft.com/beta/users/$ ( $userid ) /authentication/temporaryAccessPassMethods" - tenantid $TenantFilter - type POST - body ' {}' - verbose
1212 Write-LogMessage - headers $Headers - API $APIName - message " Created Temporary Access Password (TAP) for $userid " - Sev ' Info' - tenant $TenantFilter
1313 return @ {
14- resultText = " The TAP for this user is $ ( $GraphRequest.temporaryAccessPass ) - This TAP is usable for the next $ ( $GraphRequest.LifetimeInMinutes ) minutes"
14+ resultText = " The TAP for $userid is $ ( $GraphRequest.temporaryAccessPass ) - This TAP is usable for the next $ ( $GraphRequest.LifetimeInMinutes ) minutes"
15+ userid = $userid
1516 copyField = $GraphRequest.temporaryAccessPass
1617 temporaryAccessPass = $GraphRequest.temporaryAccessPass
1718 lifetimeInMinutes = $GraphRequest.LifetimeInMinutes
You can’t perform that action at this time.
0 commit comments