File tree Expand file tree Collapse file tree 2 files changed +11
-13
lines changed
Entrypoints/HTTP Functions/Identity/Administration/Users Expand file tree Collapse file tree 2 files changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -121,11 +121,8 @@ function Invoke-ExecJITAdmin {
121121 $PasswordExpiration = $TapRequest.LifetimeInMinutes
122122
123123 $PasswordLink = New-PwPushLink - Payload $TempPass
124- if ($PasswordLink ) {
125- $Password = $PasswordLink
126- } else {
127- $Password = $TempPass
128- }
124+ $Password = $PasswordLink ? $PasswordLink : $TempPass
125+
129126 $Results.Add (" Temporary Access Pass: $Password " )
130127 $Results.Add (" This TAP is usable starting at $ ( $TapRequest.startDateTime ) UTC for the next $PasswordExpiration minutes" )
131128 } catch {
Original file line number Diff line number Diff line change @@ -10,19 +10,20 @@ function New-CIPPTAP {
1010 try {
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
13- $Results = [System.Collections.Generic.List [string ]]::new()
14- $Results.Add (" The TAP for this user is $ ( $GraphRequest.temporaryAccessPass ) - This TAP is usable for the next $ ( $GraphRequest.LifetimeInMinutes ) minutes" )
15- $Results.Add (" $ ( $GraphRequest.temporaryAccessPass ) " )
16- return $Results
13+ return @ {
14+ resultText = " The TAP for this user is $ ( $GraphRequest.temporaryAccessPass ) - This TAP is usable for the next $ ( $GraphRequest.LifetimeInMinutes ) minutes"
15+ copyField = $GraphRequest.temporaryAccessPass
16+ temporaryAccessPass = $GraphRequest.temporaryAccessPass
17+ lifetimeInMinutes = $GraphRequest.LifetimeInMinutes
18+ startDateTime = $GraphRequest.startDateTime
19+ state = ' success'
20+ }
1721
1822 } catch {
1923 $ErrorMessage = Get-CippException - Exception $_
2024 $Result = " Failed to create Temporary Access Password (TAP) for $ ( $userid ) : $ ( $ErrorMessage.NormalizedError ) "
2125 Write-LogMessage - headers $Headers - API $APIName - message $Result - Sev ' Error' - tenant $TenantFilter - LogData $ErrorMessage
22- throw @ { Results = $Result }
23-
24-
26+ throw $Result
2527 }
26-
2728}
2829
You can’t perform that action at this time.
0 commit comments