Skip to content

Commit 352d947

Browse files
authored
Merge pull request #365 from hectoralinares/NewEncryptKey
Add New-EncryptionKeyBase64 function
2 parents a6fdafd + 671f519 commit 352d947

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Infrastructure/AzureStack.Infra.psm1

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,19 @@ function Set-AzSBackupShare {
899899

900900
Export-ModuleMember -Function Set-AzSBackupShare
901901

902+
<#
903+
.SYNOPSIS
904+
Generate encryption key for infrastructure backups
905+
#>
906+
function New-EncryptionKeyBase64 {
907+
$tempEncryptionKeyString = ""
908+
foreach($i in 1..64) { $tempEncryptionKeyString += -join ((65..90) + (97..122) | Get-Random | % {[char]$_}) }
909+
$tempEncryptionKeyBytes = [System.Text.Encoding]::UTF8.GetBytes($tempEncryptionKeyString)
910+
$BackupEncryptionKeyBase64 = [System.Convert]::ToBase64String($tempEncryptionKeyBytes)
911+
$BackupEncryptionKeyBase64
912+
}
913+
914+
Export-ModuleMember -Function New-EncryptionKeyBase64
902915

903916
function Invoke-AzsInfrastructureAction {
904917
param(

0 commit comments

Comments
 (0)