Before you begin, ensure that you have the following prerequisites in place:
- PowerShell 7.0 or higher: Make sure you have PowerShell version 7.0 or above installed on your system.
- Running Secretify Instance with Configured Microsoft Entra: Ensure that you have a Secretify instance up and running, with Microsoft Entra properly configured.
- Microsoft Entra Client Credentials for Authentication: Obtain client credentials from Microsoft Entra for authentication purposes. Secretify utilizes the Client Credentials OAuth2 flow for authentication.
The easiest and most recommended method to install the Secretify module is via the PowerShell Gallery.
-
Open a PowerShell prompt.
-
Run the following command:
Install-Module -Name Secretify
If you prefer manual installation, follow these steps:
-
Locate your PowerShell module directories by running the following command in PowerShell:
$env:PSModulePath -split ';'
-
Copy the module files to one of the listed directories. Ensure that they are placed within a folder named
Secretify.- You can download the module files from PowerShell Gallery or this git repository under
./Secretify. - After downloading, extract the files and place them in the designated PowerShell module directory.
- You can download the module files from PowerShell Gallery or this git repository under
Ensure the module is installed:
Get-Module -ListAvailable SecretifyImport the module:
Import-Module SecretifyList Module Commands:
Get-Command -Module SecretifyGet detailed information on specific commands:
Get-Help SecretifyTo authenticate with Secretify, use the New-SecretifySession cmdlet. This cmdlet submits a logon request to the Secretify API and establishes a session for subsequent operations.
$cred = Get-Credential
New-SecretifySession -Url "https://example.secretify.io" -Credential $credNote: Username is referred to as the ClientID, and password is the Client Secret provided from Microsoft Entra.
To create a secret using the Secretify module, utilize the New-SecretifySecret cmdlet. This cmdlet allows you to specify the data, type identifier, expiration time, views, and other parameters for the secret to be created.
$data = @{
message = "This is a secure message"
}
$secret = New-SecretifySecret -Data $data -TypeIdentifier "text" -ExpiresAt "24h" -Views 2 -IsDestroyable $true -HasPassphrase $falseAlternatively, if you have configured a custom secret type such as credentials, you can create a secret of that type:
$data = @{
username = "tony.stark"
password = "v3ry@S3!cure"
}
$secret = New-SecretifySecret -Data $data -TypeIdentifier "credentials" -ExpiresAt "24h" -Views 2 -IsDestroyable $true -HasPassphrase $falseTo reveal a secret, use the Read-SecretifySecret cmdlet. You can reveal a secret either by providing its URL or by specifying its identifier and key.
Read-SecretifySecret -Url $secret.Linkor
Read-SecretifySecret -Identifier $secret.Identifier -Key $secret.KeyTo generate a random password, use the Get-RandomPassword cmdlet. You can specify the length and the types of characters to include in the password.
Default values are: length 30, include numbers, symbols, lowercase, and uppercase letters.
$randomPassword = Get-RandomPasswordYou can adjust the length and character inclusion parameters as needed, minimum length is 5 characters.
$randomPassword = Get-RandomPassword -Length 12 -IncludeNumbers $true -IncludeSymbols $false -IncludeLowercase $true -IncludeUppercase $trueYou can also exclude specific characters from the generated password.
$randomPassword = Get-RandomPassword -Length 10 -Exclude "()$"To close the Secretify session and log out, use the Close-SecretifySession cmdlet.
Close-SecretifySession