Skip to content

Commit

Permalink
feat: Add logging to Get-AzKeyVaultAccessPolicies #271 (#283)
Browse files Browse the repository at this point in the history
Co-authored-by: Stijn Moreels <[email protected]>
  • Loading branch information
pimentacodit888 and stijnmoreels authored Mar 18, 2022
1 parent 76514ac commit d2eca71
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@ if($keyVault) {
storage = $keyVaultAccessPolicy.PermissionsToStorage
}

Write-Verbose "Azure Key Vault access policy successfully retrieved for TenantId: $($armAccessPolicy.tenantId) and ObjectId: $($armAccessPolicy.ObjectId)"
Write-Verbose ($armAccessPolicyPermissions | Format-list | Out-String)

$armAccessPolicy | Add-Member -MemberType NoteProperty -Name permissions -Value $armAccessPolicyPermissions
$armAccessPolicies += $armAccessPolicy
}
}

Write-Host "Successfully retrieved Azure Key Vault access policies"
}
} else {
Write-Warning "Azure Key Vault '$keyVaultName' could not be found, please check if the provided vault name and/or resource group name is correct."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ InModuleScope Arcus.Scripting.KeyVault {
Mock Get-AzKeyVault { return [pscustomobject]@{ accessPolicies = @($accessPolicy) } }

# Act
$accessPoliciesParameter = Get-AzKeyVaultAccessPolicies -KeyVaultName "key vault" -ResourceGroupName "resource group name"
$accessPoliciesParameter = Get-AzKeyVaultAccessPolicies -KeyVaultName "key vault" -ResourceGroupName "resource group name" -verbose

# Assert
$accessPolicies = $accessPoliciesParameter.list
Expand Down

0 comments on commit d2eca71

Please sign in to comment.