Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Comment on lines +722 to +723
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider filtering deleted secrets as well. The GetDeletedSecrets() method should also filter out certificate-backed secrets (where Managed == true) for consistency. When a certificate is deleted, its corresponding secret is also deleted, and it should remain hidden from the deleted secrets list. Apply the same filtering pattern used here for GetSecrets() and GetSecretVersions().

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: need to discuss if we should actually implement this on deleted secrets, azure-cli does not filter on this property for deleted keys/secrets.

}
catch (Exception ex)
{
Expand Down Expand Up @@ -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)
{
Expand Down
8 changes: 8 additions & 0 deletions src/KeyVault/KeyVault/Track2Models/Track2VaultClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ private IEnumerable<PSKeyVaultKeyIdentityItem> GetKeys(KeyClient client)
var allKeys = client.GetPropertiesOfKeys();
foreach (var keyProperties in allKeys)
{
if (keyProperties.Managed == true)
{
continue;
}
results.Add(new PSKeyVaultKeyIdentityItem(keyProperties, _vaultUriHelper, false));
}
return results;
Expand All @@ -159,6 +163,10 @@ private IEnumerable<PSKeyVaultKeyIdentityItem> GetKeyVersions(KeyClient client,
var allKeys = client.GetPropertiesOfKeyVersions(keyName);
foreach (var keyProperties in allKeys)
{
if (keyProperties.Managed == true)
{
continue;
}
results.Add(new PSKeyVaultKeyIdentityItem(keyProperties, _vaultUriHelper, false));
}
return results;
Expand Down
Loading