Skip to content

[KeyVault] Add samples for new certificate SANs (IP/URI) and secret outContentType/previousVersion features#48699

Open
rohitsinghal4u wants to merge 2 commits intomainfrom
samples/keyvault-new-features
Open

[KeyVault] Add samples for new certificate SANs (IP/URI) and secret outContentType/previousVersion features#48699
rohitsinghal4u wants to merge 2 commits intomainfrom
samples/keyvault-new-features

Conversation

@rohitsinghal4u
Copy link
Copy Markdown
Contributor

Description

This PR adds sample code demonstrating new KeyVault features:

Certificates

  • IP addresses in Subject Alternative Names (SANs)
  • URIs in Subject Alternative Names (SANs)

Secrets

  • outContentType parameter for format conversion (PFX/PEM)
  • previousVersion property on SecretProperties

Files Changed

  • sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/HelloWorld.java
  • sdk/keyvault/azure-security-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/HelloWorld.java

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds/updates Java “HelloWorld” samples in the Key Vault Certificates and Secrets libraries to demonstrate newly supported service features introduced around the 2025-07-01 API version (SAN IP/URI and secret outContentType/previousVersion).

Changes:

  • Certificates sample: extend Subject Alternative Names to include IP addresses and URIs.
  • Secrets sample: add guidance for outContentType format conversion and show accessing SecretProperties.getPreviousVersion().

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
sdk/keyvault/azure-security-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/HelloWorld.java Updates certificate creation policy sample to include SAN IP addresses and URIs.
sdk/keyvault/azure-security-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/HelloWorld.java Adds sample guidance for outContentType and previousVersion usage in secrets.

Comment on lines +50 to +52
// For certificate-backed secrets, we can retrieve the secret value in a different format using outContentType.
// For example, to get the value in PEM format instead of the default PKCS#12 format:
// KeyVaultSecret pemSecret = secretClient.getSecret("MyCertSecret", null, "application/x-pem-file");
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

The outContentType snippet uses a different secret name ("MyCertSecret") than the rest of the sample and is commented out, which makes it harder to follow when reading the sample top-to-bottom. Consider using a clearly named placeholder variable (e.g., CERT_SECRET_NAME) and explicitly noting that this call only works for certificate-backed (PFX) secrets; otherwise the service may reject the request.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

API Change Check

APIView identified API level changes in this PR and created the following API reviews

com.azure:azure-security-keyvault-certificates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

3 participants