Skip to content

Commit 83e8ce7

Browse files
authored
Central Provider and Central Credential Provider support (#15)
* splattin' it * formattin' it * Support for communicating with the Vault via Central Provider or Central Credential Provider (#14) * publish workflow * version bump to 1.0.0
1 parent 282de7e commit 83e8ce7

10 files changed

+486
-158
lines changed

.github/workflows/pester.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
shell: pwsh
1212
run: |
1313
Set-PSRepository PSGallery -InstallationPolicy Trusted
14-
Install-Module psPAS, Microsoft.PowerShell.SecretManagement
14+
Install-Module psPAS, CredentialRetriever, Microsoft.PowerShell.SecretManagement
1515
- name: Executes Pester tests
1616
shell: pwsh
1717
run: |

.github/workflows/publish.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
name: Publish Module to PowerShell Gallery
3+
4+
on:
5+
release:
6+
types: [published]
7+
8+
workflow_dispatch:
9+
10+
jobs:
11+
publish:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
17+
- name: Publish Module to PowerShell Gallery
18+
uses: pcgeek86/publish-powershell-module-action@v20
19+
id: publish-module
20+
with:
21+
NuGetApiKey: ${{ secrets.PS_GALLERY_KEY }}

README.md

+65-12
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,67 @@
11
# SecretManagement.CyberArk
22

3-
A [SecretManagement](https://github.com/powershell/secretmanagement) extension for [CyberArk](https://www.cyberark.com/). The [psPAS](https://github.com/pspete/psPAS) module is used to communicate with the Vault.
3+
A [SecretManagement](https://github.com/powershell/secretmanagement) extension for [CyberArk](https://www.cyberark.com/). It supports connecting to the Vault by either the REST API, Credential Provider, or Central Credential Provider.
4+
5+
The [psPAS](https://github.com/pspete/psPAS) or [CredentialRetriever](https://github.com/pspete/CredentialRetriever) module is used to communicate with the Vault.
46

57
## Prerequisities
68

79
* The [psPAS](https://github.com/pspete/psPAS) Powershell module
10+
* The [CredentialRetriever](https://github.com/pspete/CredentialRetriever) Powershell module
811
* The [SecretManagement](https://github.com/powershell/secretmanagement) Powershell module
912

1013
## Installation
1114

1215
From PowerShell Gallery
1316

14-
`Install-Module SecretManagement.CyberArk`
17+
```powershell
18+
Install-Module SecretManagement.CyberArk
19+
```
1520

1621
## Registration
1722

18-
Once installed, it must be registered as an extension for `SecretManagement`.
23+
Once installed, it must be registered as an extension for `SecretManagement`. Depending on how you want to connect to the Vault, you will need to provide the appropriate parameters.
24+
25+
### Credential Provider
26+
27+
Specify `CredentialProvider` as the `ConnectionType`, the `AppID` to authenticate as, and optionally a `ClientPath` to the Credential Provider executable (otherwise it will use the existing `ClientPath` previously set via `Set-AIMConfiguration`.)
28+
29+
```powershell
30+
$VaultParameters = @{
31+
ConnectionType = 'CredentialProvider'
32+
AppID = 'windowsScript'
33+
ClientPath = 'C:\Path\To\CLIPasswordSDK.exe'
34+
}
1935
20-
`Register-SecretVault -ModuleName SecretManagement.CyberArk`
36+
Register-SecretVault -Name CyberArk -ModuleName SecretManagement.CyberArk @VaultParameters
37+
```
38+
39+
### Central Credential Provider
40+
41+
Specify `CentralCredentialProvider` as the `ConnectionType`, the `AppID` to authenticate as, and the `URL` for the Central Credential Provider. Optionally, parameters such as `SkipCertificateCheck`, `UseDefaultCredentials`, `Credential`, `CertificateThumbPrint`, and `Certificate` can be specified.
42+
43+
```powershell
44+
$VaultParameters = @{
45+
ConnectionType = 'CentralCredentialProvider'
46+
AppID = 'windowsScript'
47+
URL = 'https://comp01.contoso.com'
48+
SkipCertificateCheck = $true
49+
}
50+
51+
Register-SecretVault -Name CyberArk -ModuleName SecretManagement.CyberArk @VaultParameters
52+
```
53+
54+
### REST API
55+
56+
Specify `REST` as the `ConnectionType` and an existing `PASSession` will be used.
57+
58+
```powershell
59+
$VaultParameters = @{
60+
ConnectionType = 'REST'
61+
}
62+
63+
Register-SecretVault -Name CyberArk -ModuleName SecretManagement.CyberArk @VaultParameters
64+
```
2165

2266
## Usage
2367

@@ -27,28 +71,37 @@ You use the typical `SecretManagement` commands such as `Get-Secret` and `Set-Se
2771

2872
To retrieve the password for an account named `localAdmin01`:
2973

30-
`Get-PASAccount -search localAdmin01 -safeName Windows | Get-Secret`
74+
```powershell
75+
Get-Secret -Name localAdmin01 -VaultName CyberArk
76+
```
3177

3278
or
3379

34-
`Get-Secret -Name localAdmin01`
80+
```powershell
81+
Get-PASAccount -search localAdmin01 -safeName Windows | Get-Secret -VaultName CyberArk
82+
```
3583

3684
Note: If multiple results are returned from CyberArk the first one is provided.
3785

3886
To retrieve the password for an account named `linuxAdmin01` where policy requires a reason:
3987

40-
`Get-Secret -Name localAdmin01 -AdditionalParameters @{Reason="To do things"}`
88+
```powershell
89+
Get-Secret -Name localAdmin01 -AdditionalParameters @{Reason = 'To do things' } -VaultName CyberArk
90+
```
4191

4292
To create a new credential in the Vault use:
4393

4494
```powershell
45-
$Secret = ConvertTo-SecureString "verySecret!" -AsPlainText -Force
95+
$Secret = ConvertTo-SecureString 'verySecret!' -AsPlainText -Force
4696
4797
$NewCredentialProperties = @{
48-
address="iosharp.lab";
49-
userName="localAdmin10"}
98+
platformId = 'WindowsDomainAccount'
99+
safeName = 'Windows'
100+
address = 'iosharp.lab'
101+
userName = 'localAdmin10'
102+
}
50103
51-
Set-Secret -platformId WindowsDomainAccount -safeName Windows -Secret $Secret -AdditionalParameters $NewCredentialProperties
104+
Set-Secret -VaultName CyberArk -Secret $Secret -AdditionalParameters $NewCredentialProperties
52105
```
53106

54-
Note: The value passed to the `Name` argument will be used as the `name` property for the account in CyberArk. If you want CyberArk to generate the name for the account automatically, do not use the `Name` argument.
107+
Note: The value passed to the `Name` argument will be used as the `name` property for the account in CyberArk. If you want CyberArk to generate the name for the account automatically, do not use the `Name` argument. This is not supported for the `CentralCredentialProvider` and `CredentialProvider` connection types.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@{
2-
ModuleVersion = '0.2'
3-
RootModule = 'SecretManagement.CyberArk.Extension.psm1'
4-
FunctionsToExport = @('Set-Secret','Get-Secret','Remove-Secret','Get-SecretInfo','Test-SecretVault')
2+
ModuleVersion = '1.0.0'
3+
RootModule = 'SecretManagement.CyberArk.Extension.psm1'
4+
FunctionsToExport = @('Set-Secret', 'Get-Secret', 'Remove-Secret', 'Get-SecretInfo', 'Test-SecretVault')
55
}

0 commit comments

Comments
 (0)