github Azure/azure-sdk-for-net Azure.Security.Attestation_2.0.0

latest release: Azure.ResourceManager.DeviceProvisioningServices_1.4.0
4 hours ago

2.0.0 (2026-10-30)

Features Added

  • Updated the client library to target the 2025-06-01 Azure Attestation service API version.
  • Added AttestationClientOptions.ServiceVersion.V2025_06_01, which is now the default service version. V2020_10_01 remains available for callers that need to continue targeting the previous service API version.
  • Added the AttestationType.AzureGuest, AttestationType.SevSnpVm, and AttestationType.TdxVm values. TdxVm requires service version V2025_06_01.
  • Added AttestationClient.AttestTdxVm and AttestationClient.AttestSevSnpVm (and their async counterparts) to attest Intel TDX and AMD SEV-SNP confidential virtual machines. AttestTdxVm requires service version V2025_06_01; AttestationClient.CanAttestTdxVm indicates whether the client supports it.
  • Added AttestationRequest.Nonce, which the service returns in the nonce claim of the attestation token.
  • Added AttestationResult.AdditionalClaims, which exposes the token's claims that have no dedicated property, such as the TDX and SEV-SNP claims and claims issued by attestation policy. AttestationModelFactory.AttestationResult accepts them as additionalClaims for mocking.
  • Added AttestationClient.GetOpenIdMetadata (and its async counterpart), which retrieves the attestation provider's OpenID Connect discovery document as an AttestationOpenIdMetadata.
  • Added AttestationClient.AttestAzureGuest (and its async counterpart) to attest Azure confidential and Trusted Launch virtual machines. It returns a SealedAttestationResult whose token is encrypted to the virtual machine's TPM, so the client does not validate it.
  • Added AttestationAdministrationClient.GetTcbBaselines (and its async counterpart), which lists the SGX trusted computing base (TCB) baselines an attestation policy can require, as TcbBaselineResult and TcbBaseline. It requires service version V2025_06_01; AttestationAdministrationClient.CanGetTcbBaselines indicates whether the client supports it.
  • Model types now implement IJsonModel<T> and IPersistableModel<T>, and AzureSecurityAttestationContext was added, for use with System.ClientModel.Primitives.ModelReaderWriter.

Breaking Changes

This release changes how attestation tokens are validated, so code that worked with 1.0.0 might need changes. See the migration guide for how to update it.

  • AttestationToken.ValidateToken and AttestationToken.ValidateTokenAsync now return false for unsecured tokens, that is, tokens whose alg header is none. Such tokens carry no signature, so no signature verification was performed and validation previously succeeded by default. The AttestationTokenValidationOptions.TokenValidated handler is no longer invoked for these tokens and cannot be used to accept them. Tokens returned by the Attestation service are signed and are unaffected, except for the response to an attestation request that sets DraftPolicyForAttestation: the service never signs it, so the client still returns it, as before, after checking its time claims and invoking the TokenValidated handler. Unsecured tokens sent to the service by SetPolicy and ResetPolicy are also unaffected, as they are never validated by the client.
  • Attestation tokens are now validated against their issuer by default. AttestationTokenValidationOptions.ValidateIssuer defaults to true, and AttestationClient and AttestationAdministrationClient use their endpoint as the expected issuer when ExpectedIssuer is not set. While issuer validation is enabled, a token without an issuer is rejected. Callers of AttestationToken.ValidateToken and AttestationToken.ValidateTokenAsync must set ExpectedIssuer to the base URI of the attestation provider the token must come from, or set ValidateIssuer to false.
  • AttestationToken.ValidateToken and AttestationToken.ValidateTokenAsync now accept a signed token only if one of the signing certificates passed as attestationSigningCertificates signed it. Previously, when no signing certificates were passed, the token was checked against the certificates in its own header. They now throw ArgumentNullException when attestationSigningCertificates is null and ArgumentException when it is empty; use AttestationClient.GetSigningCertificates to retrieve the attestation provider's signing certificates. Certificates and keys in a token's header are no longer used to select a signer in any case.
  • AttestationClient and AttestationAdministrationClient now throw ArgumentException when the endpoint does not use https. An AttestationClient created without a credential previously sent its requests, including the request for the certificates that validate tokens, without TLS.
  • When several handlers are attached to AttestationTokenValidationOptions.TokenValidated, the token is now rejected if any of them sets IsValid to false. Previously only the value set by the last handler was used.
  • AttestationTokenSigningKey now throws ArgumentException for keys and certificates that are not RSA, such as ECDSA keys, instead of NotSupportedException or NullReferenceException. Only RSA signing keys are supported.
  • AttestationTokenValidationOptions.TimeValidationSlack now defaults to 5 seconds instead of 0. The service sets a token's nbf claim with its own clock, which can be slightly ahead of the caller's, so with no slack a token returned by the service was intermittently rejected as not yet valid. Set TimeValidationSlack to 0 to restore exact time checks.

Bugs Fixed

  • Fixed GetPolicy throwing instead of returning a null policy when the requested attestation type has no policy configured.
  • AttestationClient.GetSigningCertificatesAsync, which the async operations also use to fetch the keys that validate tokens, no longer makes a blocking network call.
  • AttestationToken.ExpirationTime, NotBeforeTime, and IssuedAtTime no longer truncate fractional seconds in the token's exp, nbf, and iat claims.
  • With a nonzero AttestationTokenValidationOptions.TimeValidationSlack, token validation compared only the seconds component of the time elapsed since exp (or remaining until nbf) with the slack, so a token outside the slack by a whole number of minutes could pass. It now compares the total elapsed time.
  • AttestationToken.X509CertificateChain now decodes the base64-encoded certificates in the token's x5c header on all target frameworks, and returns an empty array when the header has none. On .NET 9 and earlier, and on .NET Framework, it treated each entry as a file name, so it could not read the certificates in tokens returned by the service.
  • AttestationAdministrationClient.SetPolicy, GetPolicyManagementCertificates, and GetPolicyManagementCertificatesAsync no longer throw when a TokenValidated handler is attached; they now invoke it like the other operations.
  • A token without a kid header is now checked against every signing certificate passed to ValidateToken and ValidateTokenAsync. Previously only the first was tried, so a token signed by another of them was rejected.
  • Tokens signed with an AttestationTokenSigningKey now carry the standard JWS algorithm RS256 in their alg header, instead of RSA256.
  • Tokens signed with an AttestationTokenSigningKey created from a certificate alone now use the certificate's private key. Previously, on .NET 8 and later, signing failed with a CryptographicException.
  • ValidateToken and ValidateTokenAsync now throw ArgumentNullException when options is null or attestationSigningCertificates contains null, throw ArgumentException when one of the signers has no certificate, and return false for a token without an alg header, instead of throwing NullReferenceException or ArgumentOutOfRangeException.
  • AttestationToken.ExpirationTime, NotBeforeTime, and IssuedAtTime now return DateTimeOffset.MaxValue or DateTimeOffset.MinValue for claims outside the range of DateTimeOffset, instead of throwing ArgumentOutOfRangeException, so such tokens are validated against those values.

Other Changes

  • Migrated the code generation from AutoRest/Swagger to TypeSpec.

Don't miss a new azure-sdk-for-net release

NewReleases is sending notifications on new releases.