Functions/Authentication/Remove-PASPrivateSSHKey.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# .ExternalHelp psPAS-help.xml function Remove-PASPrivateSSHKey { [CmdletBinding(SupportsShouldProcess)] param( [parameter( Mandatory = $false, ValueFromPipelinebyPropertyName = $true )] [int]$UserID ) BEGIN { Assert-VersionRequirement -RequiredVersion 12.1 }#begin PROCESS { $URI = "$Script:BaseURI/api/Users" If ($PSBoundParameters.ContainsKey('UserID')) { $user = $UserID $URI = "$URI/$UserID/Secret/SSHKeys/Cache" } else { $user = 'Personal' $URI = "$URI/Secret/SSHKeys/Cache" } if ($PSCmdlet.ShouldProcess($user, 'Delete Private SSH Key')) { #send request to webservice Invoke-PASRestMethod -Uri $URI -Method DELETE -WebSession $Script:WebSession } }#process END { }#end } |