Skip to content

Commit

Permalink
check not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
freddydk committed Jun 4, 2024
1 parent ca6122a commit ff71d9d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Actions/AL-Go-Helper.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2410,7 +2410,7 @@ function ConnectAz {
try {
Clear-AzContext -Scope Process
Clear-AzContext -Scope CurrentUser -Force -ErrorAction SilentlyContinue
if ($azureCredentials.PSObject.Properties.Name -eq 'ClientSecret') {
if ($azureCredentials.PSObject.Properties.Name -eq 'ClientSecret' -and $azureCredentials.ClientSecret) {
$credential = New-Object PSCredential -argumentList $azureCredentials.ClientId, $azureCredentials.ClientSecret
Connect-AzAccount -ServicePrincipal -Tenant $azureCredentials.TenantId -Credential $credential -WarningAction SilentlyContinue | Out-Null
}
Expand All @@ -2424,7 +2424,7 @@ function ConnectAz {
}
Connect-AzAccount -ApplicationId $azureCredentials.ClientId -Tenant $azureCredentials.TenantId -FederatedToken $result.value -WarningAction SilentlyContinue | Out-Null
}
if ($azureCredentials.PSObject.Properties.Name -eq 'SubScriptionId') {
if ($azureCredentials.PSObject.Properties.Name -eq 'SubScriptionId' -and $azureCredentials.subscriptionId) {
Set-AzContext -SubscriptionId $azureCredentials.SubscriptionId -Tenant $azureCredentials.TenantId -ErrorAction SilentlyContinue -WarningAction SilentlyContinue | Out-Null
}
$script:keyvaultConnectionExists = $true
Expand Down
6 changes: 3 additions & 3 deletions Actions/ReadSecrets/ReadSecretsHelper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ function GetKeyVaultSecret {
Get-AzKeyVaultSecret -VaultName $keyVaultCredentials.keyVaultName | ForEach-Object { $_.Name } | Out-Null
}
catch {
if ($keyVaultCredentials.PSObject.Properties.Name -eq 'ClientAssertion') {
$message = "Error trying to get secrets from Azure Key Vault, maybe your Key Vault isn't setup for role based access control?. Error was $($_.Exception.Message)"
if ($keyVaultCredentials.PSObject.Properties.Name -eq 'ClientSecret') {
$message = "Error trying to get secrets from Azure Key Vault. Error was $($_.Exception.Message)"
}
else {
$message = "Error trying to get secrets from Azure Key Vault. Error was $($_.Exception.Message)"
$message = "Error trying to get secrets from Azure Key Vault, maybe your Key Vault isn't setup for role based access control?. Error was $($_.Exception.Message)"
}
}
}
Expand Down

0 comments on commit ff71d9d

Please sign in to comment.