diff --git a/scripts/prepare-prod-secrets.ps1 b/scripts/prepare-prod-secrets.ps1 index aa29c35..65817dc 100644 --- a/scripts/prepare-prod-secrets.ps1 +++ b/scripts/prepare-prod-secrets.ps1 @@ -11,7 +11,12 @@ $ErrorActionPreference = "Stop" function New-Base64SecretValue([int]$Bytes = 48) { $buffer = [byte[]]::new($Bytes) - [System.Security.Cryptography.RandomNumberGenerator]::Fill($buffer) + $rng = [System.Security.Cryptography.RandomNumberGenerator]::Create() + try { + $rng.GetBytes($buffer) + } finally { + $rng.Dispose() + } return [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes([Convert]::ToBase64String($buffer))) }