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 {
19
19
$UserID = $Request.Query.ID ?? $Request.Body.ID
20
20
21
21
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
+
23
34
$StatusCode = [HttpStatusCode ]::OK
24
35
} catch {
25
- $Result = Get-NormalizedError - message $ ($_.Exception.Message )
36
+ $Results = Get-NormalizedError - message $ ($_.Exception.Message )
26
37
$StatusCode = [HttpStatusCode ]::InternalServerError
27
38
}
28
39
29
40
# Associate values to output bindings by calling 'Push-OutputBinding'.
30
41
Push-OutputBinding - Name Response - Value ([HttpResponseContext ]@ {
31
42
StatusCode = $StatusCode
32
- Body = @ {' Results' = $Result }
43
+ Body = @ {' Results' = $Results }
33
44
})
34
45
35
46
}
Original file line number Diff line number Diff line change @@ -11,7 +11,8 @@ function New-CIPPTAP {
11
11
$GraphRequest = New-GraphPostRequest - uri " https://graph.microsoft.com/beta/users/$ ( $userid ) /authentication/temporaryAccessPassMethods" - tenantid $TenantFilter - type POST - body ' {}' - verbose
12
12
Write-LogMessage - headers $Headers - API $APIName - message " Created Temporary Access Password (TAP) for $userid " - Sev ' Info' - tenant $TenantFilter
13
13
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
15
16
copyField = $GraphRequest.temporaryAccessPass
16
17
temporaryAccessPass = $GraphRequest.temporaryAccessPass
17
18
lifetimeInMinutes = $GraphRequest.LifetimeInMinutes
You can’t perform that action at this time.
0 commit comments