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 {
121
121
$PasswordExpiration = $TapRequest.LifetimeInMinutes
122
122
123
123
$PasswordLink = New-PwPushLink - Payload $TempPass
124
- if ($PasswordLink ) {
125
- $Password = $PasswordLink
126
- } else {
127
- $Password = $TempPass
128
- }
124
+ $Password = $PasswordLink ? $PasswordLink : $TempPass
125
+
129
126
$Results.Add (" Temporary Access Pass: $Password " )
130
127
$Results.Add (" This TAP is usable starting at $ ( $TapRequest.startDateTime ) UTC for the next $PasswordExpiration minutes" )
131
128
} catch {
Original file line number Diff line number Diff line change @@ -10,19 +10,20 @@ function New-CIPPTAP {
10
10
try {
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
- $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
+ }
17
21
18
22
} catch {
19
23
$ErrorMessage = Get-CippException - Exception $_
20
24
$Result = " Failed to create Temporary Access Password (TAP) for $ ( $userid ) : $ ( $ErrorMessage.NormalizedError ) "
21
25
Write-LogMessage - headers $Headers - API $APIName - message $Result - Sev ' Error' - tenant $TenantFilter - LogData $ErrorMessage
22
- throw @ { Results = $Result }
23
-
24
-
26
+ throw $Result
25
27
}
26
-
27
28
}
28
29
You can’t perform that action at this time.
0 commit comments