Skip to content

Commit

Permalink
[Enhancement] Encrypted Standard String (#316)
Browse files Browse the repository at this point in the history
* initial commit

* update

* undo changes

* update

* update

* update

* update modules
  • Loading branch information
singhgss authored Dec 20, 2024
1 parent 49fe265 commit 901c865
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
RootModule = 'Deploy-GuardrailsSolutionAccelerator'

# Version number of this module.
ModuleVersion = '1.0.12'
ModuleVersion = '1.0.13'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# import sub-modules
Import-Module ((Split-Path $PSScriptRoot -Parent) + "\Confirm-GSAConfigurationParameters\Confirm-GSAConfigurationParameters.psd1")
Import-Module ((Split-Path $PSScriptRoot -Parent) + "\Confirm-GSAPrerequisites\Confirm-GSAPrerequisites.psd1")
Expand Down Expand Up @@ -136,6 +135,7 @@ Function Deploy-GuardrailsSolutionAccelerator {
#>

[CmdletBinding(DefaultParameterSetName = 'newDeployment-configFilePath')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')]
param (
# path to the configuration file - for new deployments
[Parameter(mandatory = $true, ParameterSetName = 'newDeployment-configFilePath')]
Expand Down Expand Up @@ -433,8 +433,10 @@ Function Deploy-GuardrailsSolutionAccelerator {
'deployerAzureID' = $config['runtime']['userId']
}

$secretValue = (ConvertTo-SecureString -String (ConvertTo-Json $config -Depth 10) -AsPlainText -Force)
Set-AzKeyVaultSecret -VaultName $config['runtime']['keyVaultName'] -Name $configSecretName -SecretValue $secretValue -Tag $secretTags -ContentType 'application/json' -Verbose:$useVerbose | Out-Null
$secureConfig = (ConvertTo-SecureString -String (ConvertTo-Json $config -Depth 10) -AsPlainText -Force)
$encryptedConfig = $secureConfig | ConvertFrom-SecureString
$secureConfig.Dispose()
Set-AzKeyVaultSecret -VaultName $config['runtime']['keyVaultName'] -Name $configSecretName -SecretValue ($encryptedConfig | ConvertTo-SecureString) -Tag $secretTags -ContentType 'application/json' -Verbose:$useVerbose | Out-Null

Write-Host "Completed deployment of the Guardrails Solution Accelerator!" -ForegroundColor Green
}
Expand All @@ -459,5 +461,4 @@ $functionsToExport = @(
#'Update-GSAGuardrailPSModules'
#'Update-GSAWorkbookDefintion
)

Export-ModuleMember -Function $functionsToExport

0 comments on commit 901c865

Please sign in to comment.