-
Notifications
You must be signed in to change notification settings - Fork 4.1k
[DO NOT MERGE][Keyvault] Filter out certificates from Get-AzKeyVaultSecret and Get-AzKeyVaultKey
#29015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[DO NOT MERGE][Keyvault] Filter out certificates from Get-AzKeyVaultSecret and Get-AzKeyVaultKey
#29015
Changes from all commits
1dd9559
74a1c36
3bf2688
357f6dc
8e4f354
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,57 @@ | ||||||||||
|
|
||||||||||
| $debugModulePath = "$PSScriptRoot\..\..\..\..\artifacts\Debug\Az.KeyVault\Az.KeyVault.psd1" | ||||||||||
| Import-Module $debugModulePath -Force | ||||||||||
|
|
||||||||||
| $vaultName = 'danielKV7103' | ||||||||||
| . "$PSScriptRoot\..\Scripts\Common.ps1" | ||||||||||
|
Comment on lines
+5
to
+6
|
||||||||||
| $vaultName = 'danielKV7103' | |
| . "$PSScriptRoot\..\Scripts\Common.ps1" | |
| . "$PSScriptRoot\..\Scripts\Common.ps1" | |
| $vaultName = Get-KeyVaultName |
Copilot
AI
Dec 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 30-second sleep duration may not be sufficient for certificate creation to complete in all environments. Azure Key Vault certificate creation is asynchronous and can take longer depending on load. Consider either increasing the sleep duration to 60 seconds, or implementing a polling mechanism that waits for the certificate operation to complete (checking $certOp.Status until it's "completed"). The same issue exists on line 43.
Copilot
AI
Dec 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test uses outdated Pester syntax without the dash separator. Following the established convention in this codebase (see ManagedHsmDataPlaneTests.Tests.ps1 and MhsmKey.Tests.ps1), this should use modern Pester syntax with 'Should -Not -BeNullOrEmpty'. The same issue applies to lines 22, 27, 30, 47, 52, and 55.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -719,7 +719,8 @@ public IEnumerable<PSKeyVaultSecretIdentityItem> GetSecrets(KeyVaultObjectFilter | |
|
|
||
| options.NextLink = result.NextPageLink; | ||
| return (result == null) ? new List<PSKeyVaultSecretIdentityItem>() : | ||
| result.Select((secretItem) => new PSKeyVaultSecretIdentityItem(secretItem, this.vaultUriHelper)); | ||
| result.Where((secretItem) => secretItem.Managed != true) | ||
| .Select((secretItem) => new PSKeyVaultSecretIdentityItem(secretItem, this.vaultUriHelper)); | ||
DanielMicrosoft marked this conversation as resolved.
Show resolved
Hide resolved
Comment on lines
+722
to
+723
|
||
| } | ||
| catch (Exception ex) | ||
| { | ||
|
|
@@ -748,7 +749,8 @@ public IEnumerable<PSKeyVaultSecretIdentityItem> GetSecretVersions(KeyVaultObjec | |
| result = this.keyVaultClient.GetSecretVersionsNextAsync(options.NextLink).GetAwaiter().GetResult(); | ||
|
|
||
| options.NextLink = result.NextPageLink; | ||
| return result.Select((secretItem) => new PSKeyVaultSecretIdentityItem(secretItem, this.vaultUriHelper)); | ||
| return result.Where((secretItem) => secretItem.Managed != true) | ||
| .Select((secretItem) => new PSKeyVaultSecretIdentityItem(secretItem, this.vaultUriHelper)); | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hardcoded debug module path should not be included in committed tests. Other test files in the PesterTests directory do not import modules explicitly at the file level. This import should either be removed or handled through the test infrastructure. Additionally, the path uses a relative reference that assumes a specific build artifact location which may not be portable across different test environments.