Skip to content

Commit 9a7afc8

Browse files
test
1 parent 7e45dd7 commit 9a7afc8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Modules/CIPPCore/Public/Entrypoints/Invoke-ExecListAppId.ps1

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,14 @@ Function Invoke-ExecListAppId {
3737
Write-Information "ERROR: Could not set context to subscription $SubscriptionId."
3838
}
3939
$keyvaultname = ($env:WEBSITE_DEPLOYMENT_ID -split '-')[0]
40-
$env:ApplicationID = (Get-AzKeyVaultSecret -AsPlainText -VaultName $keyvaultname -Name 'ApplicationID').SecretValueText
41-
$env:TenantID = (Get-AzKeyVaultSecret -AsPlainText -VaultName $keyvaultname -Name 'TenantID').SecretValueText
40+
try {
41+
$env:ApplicationID = (Get-AzKeyVaultSecret -AsPlainText -VaultName $keyvaultname -Name 'ApplicationID').SecretValueText
42+
$env:TenantID = (Get-AzKeyVaultSecret -AsPlainText -VaultName $keyvaultname -Name 'TenantID').SecretValueText
43+
} catch {
44+
Write-LogMessage -message "Failed to retrieve secrets from KeyVault: $keyvaultname" -LogData (Get-CippException -Exception $_) -Sev 'Error'
45+
$env:ApplicationID = (Get-CippException -Exception $_)
46+
$env:TenantID = (Get-CippException -Exception $_)
47+
}
4248
}
4349
$Results = @{
4450
applicationId = $env:ApplicationID

0 commit comments

Comments
 (0)