Skip to content

Commit b1845a1

Browse files
authored
Merge pull request #5078 from SudhakaraReddyEvuri/suredd-prereqfix
ADE pre-requisite script to pass AAD client secret as a secure string
2 parents 828fd5a + 401e715 commit b1845a1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/ResourceManager/Compute/Commands.Compute/Extension/AzureDiskEncryption/Scripts/AzureDiskEncryptionPreRequisiteSetup.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,11 @@ $ErrorActionPreference = "Stop"
6262
$defaultHomePage = 'http://contoso.com';
6363
$now = [System.DateTime]::Now;
6464
$oneYearFromNow = $now.AddYears(1);
65-
$aadClientSecret = [Guid]::NewGuid();
65+
$aadClientSecret = [Guid]::NewGuid().ToString();
66+
$secureAadClientSecret = ConvertTo-SecureString -String $aadClientSecret -AsPlainText -Force;
6667

6768
Write-Host "Creating new AAD application ($aadAppName)";
68-
$ADApp = New-AzureRmADApplication -DisplayName $aadAppName -HomePage $defaultHomePage -IdentifierUris $identifierUri -StartDate $now -EndDate $oneYearFromNow -Password $aadClientSecret;
69+
$ADApp = New-AzureRmADApplication -DisplayName $aadAppName -HomePage $defaultHomePage -IdentifierUris $identifierUri -StartDate $now -EndDate $oneYearFromNow -Password $secureAadClientSecret;
6970
$servicePrincipal = New-AzureRmADServicePrincipal -ApplicationId $ADApp.ApplicationId;
7071
$SvcPrincipals = (Get-AzureRmADServicePrincipal -SearchString $aadAppName);
7172
if(-not $SvcPrincipals)

0 commit comments

Comments
 (0)