From 393d86c6f4f0b7ad5ff47496328414d92c448c0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?McCoy=20Pati=C3=B1o?= <39780829+mccoyp@users.noreply.github.com> Date: Thu, 2 Jun 2022 17:50:52 -0700 Subject: [PATCH] [KV] Log error when HSM security domain download fails (#24687) --- .vscode/cspell.json | 1 + sdk/keyvault/test-resources-post.ps1 | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.vscode/cspell.json b/.vscode/cspell.json index 0e9e18da81c5..42cc45668417 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -268,6 +268,7 @@ "rwdlacu", "scbedd", "sdist", + "sdpath", "secbak", "SECG", "SECP", diff --git a/sdk/keyvault/test-resources-post.ps1 b/sdk/keyvault/test-resources-post.ps1 index ab925d71501c..41293487ad2f 100644 --- a/sdk/keyvault/test-resources-post.ps1 +++ b/sdk/keyvault/test-resources-post.ps1 @@ -95,7 +95,13 @@ if (Test-Path $sdpath) { Remove-Item $sdPath -Force } -Export-AzKeyVaultSecurityDomain -Name $hsmName -Quorum 2 -Certificates $wrappingFiles -OutputPath $sdPath +Export-AzKeyVaultSecurityDomain -Name $hsmName -Quorum 2 -Certificates $wrappingFiles -OutputPath $sdPath -ErrorAction SilentlyContinue -Verbose +if ( !$? ) { + Write-Host $Error[0].Exception + Write-Error $Error[0] + + exit +} Log "Security domain downloaded to '$sdPath'; Managed HSM is now active at '$hsmUrl'"