File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
infra/scripts/postprovision Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -461,12 +461,19 @@ if ($clientSecrets) {
461461}
462462
463463# Create a new client secret with a 1 year expiration
464- $clientSecrets = New-AzADAppCredential - ObjectId $frontendAppRegistration .Id - EndDate ( Get-Date ).AddYears( 1 ) - ErrorAction Stop
464+ try {
465465
466- # Write to Key Vault
467- $secretValue = ConvertTo-SecureString - String $clientSecrets.SecretText - AsPlainText - Force
468- Set-AzKeyVaultSecret - VaultName $keyVault.VaultName - Name ' MicrosoftEntraId--ClientSecret' - SecretValue $secretValue - ErrorAction Stop > $null
469- Write-Host " `t Saved the $highlightColor 'MicrosoftEntraId--ClientSecret'$defaultColor to Key Vault"
466+ $clientSecrets = New-AzADAppCredential - ObjectId $frontendAppRegistration.Id - EndDate (Get-Date ).AddYears(1 ) - ErrorAction Stop
467+
468+ # Write to Key Vault
469+ $secretValue = ConvertTo-SecureString - String $clientSecrets.SecretText - AsPlainText - Force
470+ Set-AzKeyVaultSecret - VaultName $keyVault.VaultName - Name ' MicrosoftEntraId--ClientSecret' - SecretValue $secretValue - ErrorAction Stop > $null
471+ Write-Host " `t Saved the $highlightColor 'MicrosoftEntraId--ClientSecret'$defaultColor to Key Vault"
472+ } catch {
473+ $errorMessage = $_.Exception.Message
474+ Write-Warning " An error occurred saving $highlightColor 'MicrosoftEntraId--ClientSecret'$defaultColor to Key Vault: $errorMessage "
475+ Write-Warning " Please save the client secret manually or users will not be able to make authenticated requests to the web API during checkout."
476+ }
470477
471478# Get or Create the api app registration
472479$apiAppRegistration = Get-ApiAppRegistration `
You can’t perform that action at this time.
0 commit comments