secret returned only has its identifier and attributes populated. The secret values and secret versions are not listed in the response. This operation requires the secrets/list permission.Code sample
The sample below fetches all versions of the given secret. For each secret version retrieved, makes a call to getSecret(String, String) to get the version's value, and then prints it out.
for (SecretProperties secret : secretClient .listPropertiesOfSecretVersions("secretName", new Context(key1, value2))) { KeyVaultSecret secretWithValue = secretClient.getSecret(secret.getName(), secret.getVersion()); System.out.printf("Received secret's version with name %s and value %s", secretWithValue.getName(), secretWithValue.getValue()); } Iterate over secret versions by page
The sample below iterates over each secret by each page and calls SecretClient.getSecret(String, String). This will return the secret with the corresponding version's value.
secretClient.listPropertiesOfSecretVersions("secretName", new Context(key1, value2)) .iterableByPage().forEach(resp -> { System.out.printf("Got response headers . Url: %s, Status code: %d %n", resp.getRequest().getUrl(), resp.getStatusCode()); resp.getItems().forEach(value -> { KeyVaultSecret secretWithValue = secretClient.getSecret(value.getName(), value.getVersion()); System.out.printf("Received secret's version with name %s and value %s", secretWithValue.getName(), secretWithValue.getValue()); }); }); ncG1vNJzZmiZqqq%2Fpr%2FDpJuom6Njr627wWeaqKqVY8SqusOorqxmnprBcHDWnploopGrrnCt2a6pnmWjmrC2vsitsGajla7DosHLrWSsnZOnsrW%2Fjm1la2ZgZLCwuY6asa6qlWTApq%2FUq6CtsV%2BgsrrCwK6jrWejmrCzsdOsZoydk6eytY%2FLopynrF6dwa64