-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSet-ConnectionString.ps1
More file actions
58 lines (33 loc) · 1.07 KB
/
Set-ConnectionString.ps1
File metadata and controls
58 lines (33 loc) · 1.07 KB
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
48
49
50
51
52
53
54
55
56
57
58
<#PSScriptInfo
.VERSION 1.0.0
.GUID 34281b0b-eebb-4aa8-83d1-72685b9c550e
.AUTHOR Tigran TIKSN Torosyan
.COMPANYNAME tiksn.com
.COPYRIGHT FossaApp 2023
.TAGS
.LICENSEURI https://github.com/fossa-app/scripts/blob/main/LICENSE
.PROJECTURI https://github.com/fossa-app/scripts/
.ICONURI
.EXTERNALMODULEDEPENDENCIES
.REQUIREDSCRIPTS
.EXTERNALSCRIPTDEPENDENCIES
.RELEASENOTES
.PRIVATEDATA
#>
#Requires -Module Microsoft.PowerShell.Management
#Requires -Module SecretManagement.Keybase
<#
.DESCRIPTION
Set connection string
#>
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[Security.SecureString]
$Password
)
$plainTextPassword = $Password | ConvertFrom-SecureString -AsPlainText
$plainTextConnectionString = "mongodb+srv://FossaApp:$plainTextPassword@cluster0.8jcoi1w.mongodb.net/FossaApp?retryWrites=true&w=majority"
$secureConnectionString = $plainTextConnectionString | ConvertTo-SecureString -AsPlainText -Force
Set-Secret -Name 'FossaApp-ConnectionString' -Vault 'FossaApp' -SecureStringSecret $secureConnectionString