Source:
public static void main(String[] args) throws InterruptedException { CertificateAsyncClient certificateAsyncClient = new CertificateClientBuilder() .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") .credential(new DefaultAzureCredentialBuilder().build()) .buildAsyncClient(); CertificatePolicy policy = new CertificatePolicy("Self", "CN=SelfSignedJavaPkcs12") .subjectAlternativeNames(SubjectAlternativeNames.fromEmails(Arrays.asList("wow@gmail.com"))) .keyOptions(new EcKeyOptions() .reuseKey(true) .curve(KeyCurveName.P_256)); Map<String, String> tags = new HashMap<>(); tags.put("foo", "bar"); certificateAsyncClient.createCertificate("certificateName", policy, tags) .getObserver().subscribe(pollResponse -> { System.out.println("---------------------------------------------------------------------------------"); System.out.println(pollResponse.getStatus()); System.out.println(pollResponse.getValue().status()); System.out.println(pollResponse.getValue().statusDetails()); }); Thread.sleep(22000); certificateAsyncClient.deleteCertificate("certificateName") .subscribe(deletedSecretResponse -> System.out.printf("Deleted Certificate's Recovery Id %s \n", deletedSecretResponse.recoveryId())); Thread.sleep(30000); certificateAsyncClient.recoverDeletedCertificate("certificateName") .subscribe(recoveredSecretResponse -> System.out.printf("Recovered Certificate with name %s \n", recoveredSecretResponse.name())); Thread.sleep(10000); certificateAsyncClient.deleteCertificate("certificateName") .subscribe(deletedSecretResponse -> System.out.printf("Deleted Certificate's Recovery Id %s \n", deletedSecretResponse.recoveryId())); Thread.sleep(30000); certificateAsyncClient.listDeletedCertificates() .subscribe(deletedCertificateResponse -> System.out.printf("Deleted Certificate's Recovery Id %s \n", deletedCertificateResponse.recoveryId())); Thread.sleep(15000); certificateAsyncClient.purgeDeletedCertificateWithResponse("certificateName") .subscribe(purgeResponse -> System.out.printf("Purge Status response %d \n", purgeResponse.getStatusCode())); Thread.sleep(15000); }

Target:
public static void main(String[] args) throws InterruptedException { CertificateAsyncClient certificateAsyncClient = new CertificateClientBuilder() .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") .credential(new DefaultAzureCredentialBuilder().build()) .buildAsyncClient(); CertificatePolicy policy = new CertificatePolicy("Self", "CN=SelfSignedJavaPkcs12") .subjectAlternativeNames(SubjectAlternativeNames.fromEmails(Arrays.asList("wow@gmail.com"))) .keyOptions(new EcKeyOptions() .reuseKey(true) .curve(KeyCurveName.P_256)); Map<String, String> tags = new HashMap<>(); tags.put("foo", "bar"); certificateAsyncClient.createCertificate("certificateName", policy, tags) .getObserver().subscribe(pollResponse -> { System.out.println("---------------------------------------------------------------------------------"); System.out.println(pollResponse.getStatus()); System.out.println(pollResponse.getValue().status()); System.out.println(pollResponse.getValue().statusDetails()); }); Thread.sleep(22000); certificateAsyncClient.deleteCertificate("certificateName") .subscribe(deletedSecretResponse -> System.out.printf("Deleted Certificate's Recovery Id %s %n", deletedSecretResponse.recoveryId())); Thread.sleep(30000); certificateAsyncClient.recoverDeletedCertificate("certificateName") .subscribe(recoveredSecretResponse -> System.out.printf("Recovered Certificate with name %s %n", recoveredSecretResponse.name())); Thread.sleep(10000); certificateAsyncClient.deleteCertificate("certificateName") .subscribe(deletedSecretResponse -> System.out.printf("Deleted Certificate's Recovery Id %s %n", deletedSecretResponse.recoveryId())); Thread.sleep(30000); certificateAsyncClient.listDeletedCertificates() .subscribe(deletedCertificateResponse -> System.out.printf("Deleted Certificate's Recovery Id %s %n", deletedCertificateResponse.recoveryId())); Thread.sleep(15000); certificateAsyncClient.purgeDeletedCertificateWithResponse("certificateName") .subscribe(purgeResponse -> System.out.printf("Purge Status response %d %n", purgeResponse.getStatusCode())); Thread.sleep(15000); }