From f6067174a4fbafa1b234006733a726e1b338216e Mon Sep 17 00:00:00 2001
From: nisha-bhatia <67986960+nisha-bhatia@users.noreply.github.com>
Date: Wed, 1 May 2024 15:17:31 -0700
Subject: [PATCH 01/37] wip
---
...VaultAdministrationPreFullBackupHeaders.cs | 24 +++
...istrationPreFullRestoreOperationHeaders.cs | 24 +++
.../src/Generated/BackupRestoreRestClient.cs | 140 +++++++++++++++++-
...BackupOperationParameters.Serialization.cs | 44 ++++++
.../Models/PreBackupOperationParameters.cs | 36 +++++
...estoreOperationParameters.Serialization.cs | 39 +++++
.../Models/PreRestoreOperationParameters.cs | 32 ++++
.../Generated/RoleAssignmentsRestClient.cs | 2 +-
.../Generated/RoleDefinitionsRestClient.cs | 2 +-
.../src/Generated/SettingsRestClient.cs | 2 +-
.../src/autorest.md | 6 +-
.../CHANGELOG.md | 2 +
...ty.KeyVault.Certificates.netstandard2.0.cs | 3 +-
.../src/CertificateClientOptions.cs | 7 +-
.../tests/CertificatesTestBase.cs | 1 +
.../Azure.Security.KeyVault.Keys/CHANGELOG.md | 6 +
...e.Security.KeyVault.Keys.netstandard2.0.cs | 6 +-
.../Cryptography/CryptographyClientOptions.cs | 8 +-
.../src/KeyClientOptions.cs | 8 +-
.../CHANGELOG.md | 2 +
...ecurity.KeyVault.Secrets.netstandard2.0.cs | 3 +-
.../src/SecretClientOptions.cs | 7 +-
.../tests/SecretsTestBase.cs | 1 +
23 files changed, 390 insertions(+), 15 deletions(-)
create mode 100644 sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/AzureSecurityKeyVaultAdministrationPreFullBackupHeaders.cs
create mode 100644 sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/AzureSecurityKeyVaultAdministrationPreFullRestoreOperationHeaders.cs
create mode 100644 sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/Models/PreBackupOperationParameters.Serialization.cs
create mode 100644 sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/Models/PreBackupOperationParameters.cs
create mode 100644 sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/Models/PreRestoreOperationParameters.Serialization.cs
create mode 100644 sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/Models/PreRestoreOperationParameters.cs
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/AzureSecurityKeyVaultAdministrationPreFullBackupHeaders.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/AzureSecurityKeyVaultAdministrationPreFullBackupHeaders.cs
new file mode 100644
index 0000000000000..e98c641e04228
--- /dev/null
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/AzureSecurityKeyVaultAdministrationPreFullBackupHeaders.cs
@@ -0,0 +1,24 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using Azure.Core;
+
+namespace Azure.Security.KeyVault.Administration
+{
+ internal partial class AzureSecurityKeyVaultAdministrationPreFullBackupHeaders
+ {
+ private readonly Response _response;
+ public AzureSecurityKeyVaultAdministrationPreFullBackupHeaders(Response response)
+ {
+ _response = response;
+ }
+ /// The recommended number of seconds to wait before calling the URI specified in Azure-AsyncOperation.
+ public long? RetryAfter => _response.Headers.TryGetValue("Retry-After", out long? value) ? value : null;
+ /// The URI to poll for completion status.
+ public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null;
+ }
+}
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/AzureSecurityKeyVaultAdministrationPreFullRestoreOperationHeaders.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/AzureSecurityKeyVaultAdministrationPreFullRestoreOperationHeaders.cs
new file mode 100644
index 0000000000000..f706130099577
--- /dev/null
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/AzureSecurityKeyVaultAdministrationPreFullRestoreOperationHeaders.cs
@@ -0,0 +1,24 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using Azure.Core;
+
+namespace Azure.Security.KeyVault.Administration
+{
+ internal partial class AzureSecurityKeyVaultAdministrationPreFullRestoreOperationHeaders
+ {
+ private readonly Response _response;
+ public AzureSecurityKeyVaultAdministrationPreFullRestoreOperationHeaders(Response response)
+ {
+ _response = response;
+ }
+ /// The recommended number of seconds to wait before calling the URI specified in Azure-AsyncOperation.
+ public long? RetryAfter => _response.Headers.TryGetValue("Retry-After", out long? value) ? value : null;
+ /// The URI to poll for completion status.
+ public string AzureAsyncOperation => _response.Headers.TryGetValue("Azure-AsyncOperation", out string value) ? value : null;
+ }
+}
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/BackupRestoreRestClient.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/BackupRestoreRestClient.cs
index b30181ba2e982..794f0d4189865 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/BackupRestoreRestClient.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/BackupRestoreRestClient.cs
@@ -28,7 +28,7 @@ internal partial class BackupRestoreRestClient
/// The HTTP pipeline for sending and receiving REST requests and responses.
/// Api Version.
/// , or is null.
- public BackupRestoreRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string apiVersion = "7.5")
+ public BackupRestoreRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string apiVersion = "7.6-preview.1")
{
ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics));
_pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline));
@@ -104,6 +104,75 @@ public ResponseWithHeaders
}
}
+ internal HttpMessage CreatePreFullBackupRequest(string vaultBaseUrl, PreBackupOperationParameters preBackupOperationParameters)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Post;
+ var uri = new RawRequestUriBuilder();
+ uri.AppendRaw(vaultBaseUrl, false);
+ uri.AppendPath("/prebackup", false);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ if (preBackupOperationParameters != null)
+ {
+ request.Headers.Add("Content-Type", "application/json");
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(preBackupOperationParameters);
+ request.Content = content;
+ }
+ return message;
+ }
+
+ /// Pre-backup operation for checking whether the customer can perform a full backup operation.
+ /// The vault name, for example https://myvault.vault.azure.net.
+ /// Optional parameters to validate prior to performing a full backup operation.
+ /// The cancellation token to use.
+ /// is null.
+ public async Task> PreFullBackupAsync(string vaultBaseUrl, PreBackupOperationParameters preBackupOperationParameters = null, CancellationToken cancellationToken = default)
+ {
+ if (vaultBaseUrl == null)
+ {
+ throw new ArgumentNullException(nameof(vaultBaseUrl));
+ }
+
+ using var message = CreatePreFullBackupRequest(vaultBaseUrl, preBackupOperationParameters);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ var headers = new AzureSecurityKeyVaultAdministrationPreFullBackupHeaders(message.Response);
+ switch (message.Response.Status)
+ {
+ case 202:
+ return ResponseWithHeaders.FromValue(headers, message.Response);
+ default:
+ throw new RequestFailedException(message.Response);
+ }
+ }
+
+ /// Pre-backup operation for checking whether the customer can perform a full backup operation.
+ /// The vault name, for example https://myvault.vault.azure.net.
+ /// Optional parameters to validate prior to performing a full backup operation.
+ /// The cancellation token to use.
+ /// is null.
+ public ResponseWithHeaders PreFullBackup(string vaultBaseUrl, PreBackupOperationParameters preBackupOperationParameters = null, CancellationToken cancellationToken = default)
+ {
+ if (vaultBaseUrl == null)
+ {
+ throw new ArgumentNullException(nameof(vaultBaseUrl));
+ }
+
+ using var message = CreatePreFullBackupRequest(vaultBaseUrl, preBackupOperationParameters);
+ _pipeline.Send(message, cancellationToken);
+ var headers = new AzureSecurityKeyVaultAdministrationPreFullBackupHeaders(message.Response);
+ switch (message.Response.Status)
+ {
+ case 202:
+ return ResponseWithHeaders.FromValue(headers, message.Response);
+ default:
+ throw new RequestFailedException(message.Response);
+ }
+ }
+
internal HttpMessage CreateFullBackupStatusRequest(string vaultBaseUrl, string jobId)
{
var message = _pipeline.CreateMessage();
@@ -184,6 +253,75 @@ public Response FullBackupStatus(string vaultBaseUrl,
}
}
+ internal HttpMessage CreatePreFullRestoreOperationRequest(string vaultBaseUrl, PreRestoreOperationParameters preRestoreOperationParameters)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Put;
+ var uri = new RawRequestUriBuilder();
+ uri.AppendRaw(vaultBaseUrl, false);
+ uri.AppendPath("/prerestore", false);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ if (preRestoreOperationParameters != null)
+ {
+ request.Headers.Add("Content-Type", "application/json");
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(preRestoreOperationParameters);
+ request.Content = content;
+ }
+ return message;
+ }
+
+ /// Pre-restore operation for checking whether the customer can perform a full restore operation.
+ /// The vault name, for example https://myvault.vault.azure.net.
+ /// Optional pre restore parameters to validate prior to performing a full restore operation.
+ /// The cancellation token to use.
+ /// is null.
+ public async Task> PreFullRestoreOperationAsync(string vaultBaseUrl, PreRestoreOperationParameters preRestoreOperationParameters = null, CancellationToken cancellationToken = default)
+ {
+ if (vaultBaseUrl == null)
+ {
+ throw new ArgumentNullException(nameof(vaultBaseUrl));
+ }
+
+ using var message = CreatePreFullRestoreOperationRequest(vaultBaseUrl, preRestoreOperationParameters);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ var headers = new AzureSecurityKeyVaultAdministrationPreFullRestoreOperationHeaders(message.Response);
+ switch (message.Response.Status)
+ {
+ case 202:
+ return ResponseWithHeaders.FromValue(headers, message.Response);
+ default:
+ throw new RequestFailedException(message.Response);
+ }
+ }
+
+ /// Pre-restore operation for checking whether the customer can perform a full restore operation.
+ /// The vault name, for example https://myvault.vault.azure.net.
+ /// Optional pre restore parameters to validate prior to performing a full restore operation.
+ /// The cancellation token to use.
+ /// is null.
+ public ResponseWithHeaders PreFullRestoreOperation(string vaultBaseUrl, PreRestoreOperationParameters preRestoreOperationParameters = null, CancellationToken cancellationToken = default)
+ {
+ if (vaultBaseUrl == null)
+ {
+ throw new ArgumentNullException(nameof(vaultBaseUrl));
+ }
+
+ using var message = CreatePreFullRestoreOperationRequest(vaultBaseUrl, preRestoreOperationParameters);
+ _pipeline.Send(message, cancellationToken);
+ var headers = new AzureSecurityKeyVaultAdministrationPreFullRestoreOperationHeaders(message.Response);
+ switch (message.Response.Status)
+ {
+ case 202:
+ return ResponseWithHeaders.FromValue(headers, message.Response);
+ default:
+ throw new RequestFailedException(message.Response);
+ }
+ }
+
internal HttpMessage CreateFullRestoreOperationRequest(string vaultBaseUrl, RestoreOperationParameters restoreBlobDetails)
{
var message = _pipeline.CreateMessage();
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/Models/PreBackupOperationParameters.Serialization.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/Models/PreBackupOperationParameters.Serialization.cs
new file mode 100644
index 0000000000000..e1ce1dc319935
--- /dev/null
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/Models/PreBackupOperationParameters.Serialization.cs
@@ -0,0 +1,44 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.Security.KeyVault.Administration.Models
+{
+ public partial class PreBackupOperationParameters : IUtf8JsonSerializable
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
+ {
+ writer.WriteStartObject();
+ if (Optional.IsDefined(StorageResourceUri))
+ {
+ writer.WritePropertyName("storageResourceUri"u8);
+ writer.WriteStringValue(StorageResourceUri);
+ }
+ if (Optional.IsDefined(Token))
+ {
+ writer.WritePropertyName("token"u8);
+ writer.WriteStringValue(Token);
+ }
+ if (Optional.IsDefined(UseManagedIdentity))
+ {
+ writer.WritePropertyName("useManagedIdentity"u8);
+ writer.WriteBooleanValue(UseManagedIdentity.Value);
+ }
+ writer.WriteEndObject();
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this);
+ return content;
+ }
+ }
+}
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/Models/PreBackupOperationParameters.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/Models/PreBackupOperationParameters.cs
new file mode 100644
index 0000000000000..c12e9e3d32652
--- /dev/null
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/Models/PreBackupOperationParameters.cs
@@ -0,0 +1,36 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+namespace Azure.Security.KeyVault.Administration.Models
+{
+ /// The PreBackupOperationParameters.
+ public partial class PreBackupOperationParameters
+ {
+ /// Initializes a new instance of .
+ public PreBackupOperationParameters()
+ {
+ }
+
+ /// Initializes a new instance of .
+ /// Azure Blob storage container Uri.
+ /// The SAS token pointing to an Azure Blob storage container.
+ /// Indicates which authentication method should be used. If set to true, Managed HSM will use the configured user-assigned managed identity to authenticate with Azure Storage. Otherwise, a SAS token has to be specified.
+ internal PreBackupOperationParameters(string storageResourceUri, string token, bool? useManagedIdentity)
+ {
+ StorageResourceUri = storageResourceUri;
+ Token = token;
+ UseManagedIdentity = useManagedIdentity;
+ }
+
+ /// Azure Blob storage container Uri.
+ public string StorageResourceUri { get; set; }
+ /// The SAS token pointing to an Azure Blob storage container.
+ public string Token { get; set; }
+ /// Indicates which authentication method should be used. If set to true, Managed HSM will use the configured user-assigned managed identity to authenticate with Azure Storage. Otherwise, a SAS token has to be specified.
+ public bool? UseManagedIdentity { get; set; }
+ }
+}
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/Models/PreRestoreOperationParameters.Serialization.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/Models/PreRestoreOperationParameters.Serialization.cs
new file mode 100644
index 0000000000000..e312edb984c2a
--- /dev/null
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/Models/PreRestoreOperationParameters.Serialization.cs
@@ -0,0 +1,39 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.Security.KeyVault.Administration.Models
+{
+ public partial class PreRestoreOperationParameters : IUtf8JsonSerializable
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
+ {
+ writer.WriteStartObject();
+ if (Optional.IsDefined(SasTokenParameters))
+ {
+ writer.WritePropertyName("sasTokenParameters"u8);
+ writer.WriteObjectValue(SasTokenParameters);
+ }
+ if (Optional.IsDefined(FolderToRestore))
+ {
+ writer.WritePropertyName("folderToRestore"u8);
+ writer.WriteStringValue(FolderToRestore);
+ }
+ writer.WriteEndObject();
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this);
+ return content;
+ }
+ }
+}
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/Models/PreRestoreOperationParameters.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/Models/PreRestoreOperationParameters.cs
new file mode 100644
index 0000000000000..761eac8f80162
--- /dev/null
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/Models/PreRestoreOperationParameters.cs
@@ -0,0 +1,32 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+namespace Azure.Security.KeyVault.Administration.Models
+{
+ /// The PreRestoreOperationParameters.
+ public partial class PreRestoreOperationParameters
+ {
+ /// Initializes a new instance of .
+ public PreRestoreOperationParameters()
+ {
+ }
+
+ /// Initializes a new instance of .
+ ///
+ /// The Folder name of the blob where the previous successful full backup was stored.
+ internal PreRestoreOperationParameters(SASTokenParameter sasTokenParameters, string folderToRestore)
+ {
+ SasTokenParameters = sasTokenParameters;
+ FolderToRestore = folderToRestore;
+ }
+
+ /// Gets or sets the sas token parameters.
+ public SASTokenParameter SasTokenParameters { get; set; }
+ /// The Folder name of the blob where the previous successful full backup was stored.
+ public string FolderToRestore { get; set; }
+ }
+}
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/RoleAssignmentsRestClient.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/RoleAssignmentsRestClient.cs
index 8cdf96815723c..60475edd03da5 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/RoleAssignmentsRestClient.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/RoleAssignmentsRestClient.cs
@@ -28,7 +28,7 @@ internal partial class RoleAssignmentsRestClient
/// The HTTP pipeline for sending and receiving REST requests and responses.
/// Api Version.
/// , or is null.
- public RoleAssignmentsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string apiVersion = "7.5")
+ public RoleAssignmentsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string apiVersion = "7.6-preview.1")
{
ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics));
_pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline));
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/RoleDefinitionsRestClient.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/RoleDefinitionsRestClient.cs
index 6221ad1e783cb..9b47b644ea830 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/RoleDefinitionsRestClient.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/RoleDefinitionsRestClient.cs
@@ -28,7 +28,7 @@ internal partial class RoleDefinitionsRestClient
/// The HTTP pipeline for sending and receiving REST requests and responses.
/// Api Version.
/// , or is null.
- public RoleDefinitionsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string apiVersion = "7.5")
+ public RoleDefinitionsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string apiVersion = "7.6-preview.1")
{
ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics));
_pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline));
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/SettingsRestClient.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/SettingsRestClient.cs
index 7a898bfb4b4b5..924e65f68b0fa 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/SettingsRestClient.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/SettingsRestClient.cs
@@ -28,7 +28,7 @@ internal partial class SettingsRestClient
/// The HTTP pipeline for sending and receiving REST requests and responses.
/// Api Version.
/// , or is null.
- public SettingsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string apiVersion = "7.5")
+ public SettingsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string apiVersion = "7.6-preview.1")
{
ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics));
_pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline));
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/autorest.md b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/autorest.md
index 4135789b16a20..58678e5a06528 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/autorest.md
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/autorest.md
@@ -9,9 +9,9 @@ Run `dotnet build /t:GenerateCode` in src directory to re-generate.
``` yaml
title: Azure.Security.KeyVault.Administration
input-file:
-- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/7452e1cc7db72fbc6cd9539b390d8b8e5c2a1864/specification/keyvault/data-plane/Microsoft.KeyVault/stable/7.5/rbac.json
-- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/7452e1cc7db72fbc6cd9539b390d8b8e5c2a1864/specification/keyvault/data-plane/Microsoft.KeyVault/stable/7.5/backuprestore.json
-- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/7452e1cc7db72fbc6cd9539b390d8b8e5c2a1864/specification/keyvault/data-plane/Microsoft.KeyVault/stable/7.5/settings.json
+- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/8af9817c15d688c941cda106758045b5deb9a069/specification/keyvault/data-plane/Microsoft.KeyVault/preview/7.6-preview.1/rbac.json
+- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/8af9817c15d688c941cda106758045b5deb9a069/specification/keyvault/data-plane/Microsoft.KeyVault/preview/7.6-preview.1/backuprestore.json
+- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/8af9817c15d688c941cda106758045b5deb9a069/specification/keyvault/data-plane/Microsoft.KeyVault/preview/7.6-preview.1/settings.json
namespace: Azure.Security.KeyVault.Administration
generation1-convenience-client: true
include-csproj: disable
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Certificates/CHANGELOG.md b/sdk/keyvault/Azure.Security.KeyVault.Certificates/CHANGELOG.md
index e040932d1035a..191162723fdba 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Certificates/CHANGELOG.md
+++ b/sdk/keyvault/Azure.Security.KeyVault.Certificates/CHANGELOG.md
@@ -10,6 +10,8 @@
### Other Changes
+- The default service version is now "7.5-preview.1".
+
## 4.6.0 (2024-02-14)
Changes from both the last release and the last beta include:
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Certificates/api/Azure.Security.KeyVault.Certificates.netstandard2.0.cs b/sdk/keyvault/Azure.Security.KeyVault.Certificates/api/Azure.Security.KeyVault.Certificates.netstandard2.0.cs
index 8ba696e10ee1a..f24667ced66e8 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Certificates/api/Azure.Security.KeyVault.Certificates.netstandard2.0.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Certificates/api/Azure.Security.KeyVault.Certificates.netstandard2.0.cs
@@ -73,7 +73,7 @@ public CertificateClient(System.Uri vaultUri, Azure.Core.TokenCredential credent
}
public partial class CertificateClientOptions : Azure.Core.ClientOptions
{
- public CertificateClientOptions(Azure.Security.KeyVault.Certificates.CertificateClientOptions.ServiceVersion version = Azure.Security.KeyVault.Certificates.CertificateClientOptions.ServiceVersion.V7_5) { }
+ public CertificateClientOptions(Azure.Security.KeyVault.Certificates.CertificateClientOptions.ServiceVersion version = Azure.Security.KeyVault.Certificates.CertificateClientOptions.ServiceVersion.V7_6_Preview_1) { }
public bool DisableChallengeResourceVerification { get { throw null; } set { } }
public Azure.Security.KeyVault.Certificates.CertificateClientOptions.ServiceVersion Version { get { throw null; } }
public enum ServiceVersion
@@ -84,6 +84,7 @@ public enum ServiceVersion
V7_3 = 3,
V7_4 = 4,
V7_5 = 5,
+ V7_6_Preview_1 = 6,
}
}
public partial class CertificateContact
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/CertificateClientOptions.cs b/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/CertificateClientOptions.cs
index b63f82c4cf569..c45d67166c78f 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/CertificateClientOptions.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/CertificateClientOptions.cs
@@ -16,7 +16,7 @@ public class CertificateClientOptions : ClientOptions
/// For more information, see
/// Key Vault versions.
///
- internal const ServiceVersion LatestVersion = ServiceVersion.V7_5;
+ internal const ServiceVersion LatestVersion = ServiceVersion.V7_6_Preview_1;
///
/// The versions of Azure Key Vault supported by this client
@@ -54,6 +54,11 @@ public enum ServiceVersion
/// The Key Vault API version 7.5.
///
V7_5 = 5,
+
+ ///
+ /// The Key Vault API version V7_6_Preview_1.
+ ///
+ V7_6_Preview_1 = 6,
#pragma warning restore CA1707 // Identifiers should not contain underscores
}
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Certificates/tests/CertificatesTestBase.cs b/sdk/keyvault/Azure.Security.KeyVault.Certificates/tests/CertificatesTestBase.cs
index b38b255f8363b..6620b70d41c54 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Certificates/tests/CertificatesTestBase.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Certificates/tests/CertificatesTestBase.cs
@@ -13,6 +13,7 @@
namespace Azure.Security.KeyVault.Certificates.Tests
{
[ClientTestFixture(
+ CertificateClientOptions.ServiceVersion.V7_6_Preview_1,
CertificateClientOptions.ServiceVersion.V7_5,
CertificateClientOptions.ServiceVersion.V7_4,
CertificateClientOptions.ServiceVersion.V7_3,
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Keys/CHANGELOG.md b/sdk/keyvault/Azure.Security.KeyVault.Keys/CHANGELOG.md
index 00f3e43cec7e9..e4aeb9c36c5c6 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Keys/CHANGELOG.md
+++ b/sdk/keyvault/Azure.Security.KeyVault.Keys/CHANGELOG.md
@@ -4,12 +4,18 @@
### Features Added
+- Added `KeyProperties.HsmPlatform` to get the underlying HSM platform.
+
### Breaking Changes
### Bugs Fixed
+- `KeyRotationPolicyAction` performs case-insensitive comparisons since Key Vault and Managed HSM return different cases for "rotate".
+
### Other Changes
+- The default service version is now "V7_6_Preview_1".
+
## 4.6.0 (2024-02-14)
Changes from both the last release and the last beta include:
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Keys/api/Azure.Security.KeyVault.Keys.netstandard2.0.cs b/sdk/keyvault/Azure.Security.KeyVault.Keys/api/Azure.Security.KeyVault.Keys.netstandard2.0.cs
index c33c46631e8aa..77b3469313e9c 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Keys/api/Azure.Security.KeyVault.Keys.netstandard2.0.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Keys/api/Azure.Security.KeyVault.Keys.netstandard2.0.cs
@@ -159,7 +159,7 @@ public KeyClient(System.Uri vaultUri, Azure.Core.TokenCredential credential, Azu
}
public partial class KeyClientOptions : Azure.Core.ClientOptions
{
- public KeyClientOptions(Azure.Security.KeyVault.Keys.KeyClientOptions.ServiceVersion version = Azure.Security.KeyVault.Keys.KeyClientOptions.ServiceVersion.V7_5) { }
+ public KeyClientOptions(Azure.Security.KeyVault.Keys.KeyClientOptions.ServiceVersion version = Azure.Security.KeyVault.Keys.KeyClientOptions.ServiceVersion.V7_6_Preview_1) { }
public bool DisableChallengeResourceVerification { get { throw null; } set { } }
public Azure.Security.KeyVault.Keys.KeyClientOptions.ServiceVersion Version { get { throw null; } }
public enum ServiceVersion
@@ -170,6 +170,7 @@ public enum ServiceVersion
V7_3 = 3,
V7_4 = 4,
V7_5 = 5,
+ V7_6_Preview_1 = 6,
}
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
@@ -429,7 +430,7 @@ public CryptographyClient(System.Uri keyId, Azure.Core.TokenCredential credentia
}
public partial class CryptographyClientOptions : Azure.Core.ClientOptions
{
- public CryptographyClientOptions(Azure.Security.KeyVault.Keys.Cryptography.CryptographyClientOptions.ServiceVersion version = Azure.Security.KeyVault.Keys.Cryptography.CryptographyClientOptions.ServiceVersion.V7_5) { }
+ public CryptographyClientOptions(Azure.Security.KeyVault.Keys.Cryptography.CryptographyClientOptions.ServiceVersion version = Azure.Security.KeyVault.Keys.Cryptography.CryptographyClientOptions.ServiceVersion.V7_6_Preview_1) { }
public bool DisableChallengeResourceVerification { get { throw null; } set { } }
public Azure.Security.KeyVault.Keys.Cryptography.CryptographyClientOptions.ServiceVersion Version { get { throw null; } }
public enum ServiceVersion
@@ -440,6 +441,7 @@ public enum ServiceVersion
V7_3 = 3,
V7_4 = 4,
V7_5 = 5,
+ V7_6_Preview_1 = 6,
}
}
public partial class DecryptParameters
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Keys/src/Cryptography/CryptographyClientOptions.cs b/sdk/keyvault/Azure.Security.KeyVault.Keys/src/Cryptography/CryptographyClientOptions.cs
index ebc5f47514f5a..4e3ef29d22cb8 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Keys/src/Cryptography/CryptographyClientOptions.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Keys/src/Cryptography/CryptographyClientOptions.cs
@@ -16,7 +16,7 @@ public class CryptographyClientOptions : ClientOptions
/// For more information, see
/// Key Vault versions.
///
- internal const ServiceVersion LatestVersion = ServiceVersion.V7_5;
+ internal const ServiceVersion LatestVersion = ServiceVersion.V7_6_Preview_1;
///
/// The versions of Azure Key Vault supported by this client
@@ -54,6 +54,11 @@ public enum ServiceVersion
/// The Key Vault API version 7.5.
///
V7_5 = 5,
+
+ ///
+ /// The Key Vault API version 7.6-preview.1.
+ ///
+ V7_6_Preview_1 = 6,
#pragma warning restore CA1707 // Identifiers should not contain underscores
}
@@ -94,6 +99,7 @@ internal string GetVersionString()
ServiceVersion.V7_3 => "7.3",
ServiceVersion.V7_4 => "7.4",
ServiceVersion.V7_5 => "7.5",
+ ServiceVersion.V7_6_Preview_1 => "7.6-preview.1",
_ => throw new ArgumentException(Version.ToString()),
};
}
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Keys/src/KeyClientOptions.cs b/sdk/keyvault/Azure.Security.KeyVault.Keys/src/KeyClientOptions.cs
index 0a423f9734386..53af4ace6a14d 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Keys/src/KeyClientOptions.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Keys/src/KeyClientOptions.cs
@@ -16,7 +16,7 @@ public class KeyClientOptions : ClientOptions
/// For more information, see
/// Key Vault versions.
///
- internal const ServiceVersion LatestVersion = ServiceVersion.V7_5;
+ internal const ServiceVersion LatestVersion = ServiceVersion.V7_6_Preview_1;
///
/// The versions of Azure Key Vault supported by this client
@@ -54,6 +54,11 @@ public enum ServiceVersion
/// The Key Vault API version 7.5.
///
V7_5 = 5,
+
+ ///
+ /// The Key Vault API version V7_6_Preview_1.
+ ///
+ V7_6_Preview_1 = 6,
#pragma warning restore CA1707 // Identifiers should not contain underscores
}
@@ -94,6 +99,7 @@ internal string GetVersionString()
ServiceVersion.V7_3 => "7.3",
ServiceVersion.V7_4 => "7.4",
ServiceVersion.V7_5 => "7.5",
+ ServiceVersion.V7_6_Preview_1 => "7.6-preview.1",
_ => throw new ArgumentException(Version.ToString()),
};
}
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Secrets/CHANGELOG.md b/sdk/keyvault/Azure.Security.KeyVault.Secrets/CHANGELOG.md
index c5f0e76d6ea0d..8294e5c5e7aab 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Secrets/CHANGELOG.md
+++ b/sdk/keyvault/Azure.Security.KeyVault.Secrets/CHANGELOG.md
@@ -10,6 +10,8 @@
### Other Changes
+- The default service version is now "V7_6_Preview_1".
+
## 4.6.0 (2024-02-14)
Changes from both the last release and the last beta include:
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Secrets/api/Azure.Security.KeyVault.Secrets.netstandard2.0.cs b/sdk/keyvault/Azure.Security.KeyVault.Secrets/api/Azure.Security.KeyVault.Secrets.netstandard2.0.cs
index c231ef8a47bd2..dfae31cd72cab 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Secrets/api/Azure.Security.KeyVault.Secrets.netstandard2.0.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Secrets/api/Azure.Security.KeyVault.Secrets.netstandard2.0.cs
@@ -95,7 +95,7 @@ public SecretClient(System.Uri vaultUri, Azure.Core.TokenCredential credential,
}
public partial class SecretClientOptions : Azure.Core.ClientOptions
{
- public SecretClientOptions(Azure.Security.KeyVault.Secrets.SecretClientOptions.ServiceVersion version = Azure.Security.KeyVault.Secrets.SecretClientOptions.ServiceVersion.V7_5) { }
+ public SecretClientOptions(Azure.Security.KeyVault.Secrets.SecretClientOptions.ServiceVersion version = Azure.Security.KeyVault.Secrets.SecretClientOptions.ServiceVersion.V7_6_Preview_1) { }
public bool DisableChallengeResourceVerification { get { throw null; } set { } }
public Azure.Security.KeyVault.Secrets.SecretClientOptions.ServiceVersion Version { get { throw null; } }
public enum ServiceVersion
@@ -106,6 +106,7 @@ public enum ServiceVersion
V7_3 = 3,
V7_4 = 4,
V7_5 = 5,
+ V7_6_Preview_1 = 6
}
}
public static partial class SecretModelFactory
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/SecretClientOptions.cs b/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/SecretClientOptions.cs
index 86022586ccb4f..4d82929a6aa85 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/SecretClientOptions.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/SecretClientOptions.cs
@@ -16,7 +16,7 @@ public class SecretClientOptions : ClientOptions
/// For more information, see
/// Key Vault versions.
///
- internal const ServiceVersion LatestVersion = ServiceVersion.V7_5;
+ internal const ServiceVersion LatestVersion = ServiceVersion.V7_6_Preview_1;
///
/// The versions of Azure Key Vault supported by this client library.
@@ -53,6 +53,11 @@ public enum ServiceVersion
/// The Key Vault API version 7.5.
///
V7_5 = 5,
+
+ ///
+ /// The Key Vault API version 7.6-preview.1.
+ ///
+ V7_6_Preview_1 = 6,
#pragma warning restore CA1707 // Identifiers should not contain underscores
}
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Secrets/tests/SecretsTestBase.cs b/sdk/keyvault/Azure.Security.KeyVault.Secrets/tests/SecretsTestBase.cs
index 4b3f24fe846f4..1b5f7577b81ca 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Secrets/tests/SecretsTestBase.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Secrets/tests/SecretsTestBase.cs
@@ -14,6 +14,7 @@
namespace Azure.Security.KeyVault.Secrets.Tests
{
[ClientTestFixture(
+ SecretClientOptions.ServiceVersion.V7_6_Preview_1,
SecretClientOptions.ServiceVersion.V7_5,
SecretClientOptions.ServiceVersion.V7_4,
SecretClientOptions.ServiceVersion.V7_3,
From 4ad166e3fb6356f451ab4e6efdad1dde3b5024de Mon Sep 17 00:00:00 2001
From: nisha-bhatia <67986960+nisha-bhatia@users.noreply.github.com>
Date: Wed, 1 May 2024 15:33:15 -0700
Subject: [PATCH 02/37] wip
---
.../src/Cryptography/CryptographyClientOptions.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Keys/src/Cryptography/CryptographyClientOptions.cs b/sdk/keyvault/Azure.Security.KeyVault.Keys/src/Cryptography/CryptographyClientOptions.cs
index 4e3ef29d22cb8..e4e3d9f681054 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Keys/src/Cryptography/CryptographyClientOptions.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Keys/src/Cryptography/CryptographyClientOptions.cs
@@ -57,7 +57,7 @@ public enum ServiceVersion
///
/// The Key Vault API version 7.6-preview.1.
- ///
+ ///
V7_6_Preview_1 = 6,
#pragma warning restore CA1707 // Identifiers should not contain underscores
}
From 651f56e7d64af97cfb43e73acf005e95751b5376 Mon Sep 17 00:00:00 2001
From: nisha-bhatia <67986960+nisha-bhatia@users.noreply.github.com>
Date: Wed, 1 May 2024 15:35:27 -0700
Subject: [PATCH 03/37] Update
Azure.Security.KeyVault.Secrets.netstandard2.0.cs
---
.../api/Azure.Security.KeyVault.Secrets.netstandard2.0.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Secrets/api/Azure.Security.KeyVault.Secrets.netstandard2.0.cs b/sdk/keyvault/Azure.Security.KeyVault.Secrets/api/Azure.Security.KeyVault.Secrets.netstandard2.0.cs
index dfae31cd72cab..fffa9c1137641 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Secrets/api/Azure.Security.KeyVault.Secrets.netstandard2.0.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Secrets/api/Azure.Security.KeyVault.Secrets.netstandard2.0.cs
@@ -106,7 +106,7 @@ public enum ServiceVersion
V7_3 = 3,
V7_4 = 4,
V7_5 = 5,
- V7_6_Preview_1 = 6
+ V7_6_Preview_1 = 6,
}
}
public static partial class SecretModelFactory
From 9dd26e8d5b788551d3522c4f65afe223c65a0eb1 Mon Sep 17 00:00:00 2001
From: nisha-bhatia <67986960+nisha-bhatia@users.noreply.github.com>
Date: Fri, 3 May 2024 16:35:06 -0700
Subject: [PATCH 04/37] update generation
---
.../Models/PreRestoreOperationParameters.Serialization.cs | 2 +-
.../src/Generated/Models/PreRestoreOperationParameters.cs | 2 +-
.../src/PreRestoreOperationParameters.cs | 8 ++++++++
.../src/KeyRotationLifetimeAction.cs | 1 +
.../Azure.Security.KeyVault.Keys/tests/KeysTestBase.cs | 1 +
.../src/SecretClientOptions.cs | 1 +
sdk/keyvault/CONTRIBUTING.md | 2 +-
7 files changed, 14 insertions(+), 3 deletions(-)
create mode 100644 sdk/keyvault/Azure.Security.KeyVault.Administration/src/PreRestoreOperationParameters.cs
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/Models/PreRestoreOperationParameters.Serialization.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/Models/PreRestoreOperationParameters.Serialization.cs
index e312edb984c2a..45d6d2d44270a 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/Models/PreRestoreOperationParameters.Serialization.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/Models/PreRestoreOperationParameters.Serialization.cs
@@ -10,7 +10,7 @@
namespace Azure.Security.KeyVault.Administration.Models
{
- public partial class PreRestoreOperationParameters : IUtf8JsonSerializable
+ internal partial class PreRestoreOperationParameters : IUtf8JsonSerializable
{
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
{
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/Models/PreRestoreOperationParameters.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/Models/PreRestoreOperationParameters.cs
index 761eac8f80162..f2985849bc639 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/Models/PreRestoreOperationParameters.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/Generated/Models/PreRestoreOperationParameters.cs
@@ -8,7 +8,7 @@
namespace Azure.Security.KeyVault.Administration.Models
{
/// The PreRestoreOperationParameters.
- public partial class PreRestoreOperationParameters
+ internal partial class PreRestoreOperationParameters
{
/// Initializes a new instance of .
public PreRestoreOperationParameters()
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/PreRestoreOperationParameters.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/PreRestoreOperationParameters.cs
new file mode 100644
index 0000000000000..009ea64b3238b
--- /dev/null
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/PreRestoreOperationParameters.cs
@@ -0,0 +1,8 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+namespace Azure.Security.KeyVault.Administration.Models
+{
+ internal partial class PreRestoreOperationParameters
+ { }
+}
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Keys/src/KeyRotationLifetimeAction.cs b/sdk/keyvault/Azure.Security.KeyVault.Keys/src/KeyRotationLifetimeAction.cs
index 8b6baff2d3254..34499114c71d5 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Keys/src/KeyRotationLifetimeAction.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Keys/src/KeyRotationLifetimeAction.cs
@@ -37,6 +37,7 @@ internal KeyRotationLifetimeAction()
///
/// Gets the that will be executed.
+ /// The value is compared case-insensitively by the service.
///
public KeyRotationPolicyAction Action { get; private set; }
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Keys/tests/KeysTestBase.cs b/sdk/keyvault/Azure.Security.KeyVault.Keys/tests/KeysTestBase.cs
index 5de9d50e622d6..a2dd49ddea8ce 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Keys/tests/KeysTestBase.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Keys/tests/KeysTestBase.cs
@@ -13,6 +13,7 @@
namespace Azure.Security.KeyVault.Keys.Tests
{
[ClientTestFixture(
+ KeyClientOptions.ServiceVersion.V7_6_Preview_1,
KeyClientOptions.ServiceVersion.V7_5,
KeyClientOptions.ServiceVersion.V7_4,
KeyClientOptions.ServiceVersion.V7_3,
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/SecretClientOptions.cs b/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/SecretClientOptions.cs
index 4d82929a6aa85..66dc3d1b60723 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/SecretClientOptions.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/SecretClientOptions.cs
@@ -97,6 +97,7 @@ internal string GetVersionString()
ServiceVersion.V7_3 => "7.3",
ServiceVersion.V7_4 => "7.4",
ServiceVersion.V7_5 => "7.5",
+ ServiceVersion.V7_6_Preview_1 => "7.6-preview.1",
_ => throw new ArgumentException(Version.ToString()),
};
}
diff --git a/sdk/keyvault/CONTRIBUTING.md b/sdk/keyvault/CONTRIBUTING.md
index 0ab0173033923..8a06dc6ad3d8f 100644
--- a/sdk/keyvault/CONTRIBUTING.md
+++ b/sdk/keyvault/CONTRIBUTING.md
@@ -70,7 +70,7 @@ The recorded tests are run automatically on every pull request. Live tests are r
Before running or recording live tests you need to create [live test resources][live_tests]. In addition to the standard parameters to `New-TestResources.ps1`, you can pass additional parameters for Azure Key Vault:
```powershell
-eng\common\TestResources\New-TestResources.ps1 `
+eng\common\TestResources\New-TestResources.ps1 -UserAuth true `
-ServiceDirectory 'keyvault' `
-AdditionalParameters @{
# Enable Managed HSM provisioning and testing.
From 89f2e32b45727be1da2872f13b61180d0383d89f Mon Sep 17 00:00:00 2001
From: nisha-bhatia <67986960+nisha-bhatia@users.noreply.github.com>
Date: Mon, 6 May 2024 17:13:47 -0700
Subject: [PATCH 05/37] Update
Azure.Security.KeyVault.Administration.netstandard2.0.cs
---
....Security.KeyVault.Administration.netstandard2.0.cs | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/api/Azure.Security.KeyVault.Administration.netstandard2.0.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/api/Azure.Security.KeyVault.Administration.netstandard2.0.cs
index 32a5847b1b3e6..190260d78d90e 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/api/Azure.Security.KeyVault.Administration.netstandard2.0.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/api/Azure.Security.KeyVault.Administration.netstandard2.0.cs
@@ -337,3 +337,13 @@ public readonly partial struct KeyVaultSettingValue
public override string ToString() { throw null; }
}
}
+namespace Azure.Security.KeyVault.Administration.Models
+{
+ public partial class PreBackupOperationParameters
+ {
+ public PreBackupOperationParameters() { }
+ public string StorageResourceUri { get { throw null; } set { } }
+ public string Token { get { throw null; } set { } }
+ public bool? UseManagedIdentity { get { throw null; } set { } }
+ }
+}
From acbee48cc9b25e598179173f75108e7aecf13b9d Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Tue, 23 Jul 2024 13:32:07 -0700
Subject: [PATCH 06/37] Update CONTRIBUTING.md
---
sdk/keyvault/CONTRIBUTING.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sdk/keyvault/CONTRIBUTING.md b/sdk/keyvault/CONTRIBUTING.md
index 8a06dc6ad3d8f..0ab0173033923 100644
--- a/sdk/keyvault/CONTRIBUTING.md
+++ b/sdk/keyvault/CONTRIBUTING.md
@@ -70,7 +70,7 @@ The recorded tests are run automatically on every pull request. Live tests are r
Before running or recording live tests you need to create [live test resources][live_tests]. In addition to the standard parameters to `New-TestResources.ps1`, you can pass additional parameters for Azure Key Vault:
```powershell
-eng\common\TestResources\New-TestResources.ps1 -UserAuth true `
+eng\common\TestResources\New-TestResources.ps1 `
-ServiceDirectory 'keyvault' `
-AdditionalParameters @{
# Enable Managed HSM provisioning and testing.
From 1ce7dd5ee0bd6b7ffd0c067dc33351de82b249cf Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Tue, 23 Jul 2024 14:53:17 -0700
Subject: [PATCH 07/37] Add new version in ClientOptions and tests for
Administration
---
.../src/KeyVaultAdministrationClientOptions.cs | 8 +++++++-
.../tests/AdministrationTestBase.cs | 1 +
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultAdministrationClientOptions.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultAdministrationClientOptions.cs
index baf00abf0c86e..8e2144f9ac424 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultAdministrationClientOptions.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultAdministrationClientOptions.cs
@@ -18,7 +18,7 @@ public class KeyVaultAdministrationClientOptions : ClientOptions
/// For more information, see
/// Key Vault versions.
///
- internal const ServiceVersion LatestVersion = ServiceVersion.V7_5;
+ internal const ServiceVersion LatestVersion = ServiceVersion.V7_6_Preview_1;
///
/// The versions of Azure Key Vault supported by this client
@@ -46,6 +46,11 @@ public enum ServiceVersion
/// The Key Vault API version 7.5.
///
V7_5 = 4,
+
+ ///
+ /// The Key Vault API version 7.6-preview.1.
+ ///
+ V7_6_Preview_1 = 5,
#pragma warning restore CA1707 // Identifiers should not contain underscores
}
@@ -83,6 +88,7 @@ internal string GetVersionString()
ServiceVersion.V7_3 => "7.3",
ServiceVersion.V7_4 => "7.4",
ServiceVersion.V7_5 => "7.5",
+ ServiceVersion.V7_6_Preview_1 => "7.6-preview.1",
_ => throw new ArgumentException(Version.ToString()),
};
}
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/AdministrationTestBase.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/AdministrationTestBase.cs
index 9cd66922f4728..57860b6ff99bb 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/AdministrationTestBase.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/AdministrationTestBase.cs
@@ -16,6 +16,7 @@ namespace Azure.Security.KeyVault.Administration.Tests
/// Base class for recorded Administration tests.
///
[ClientTestFixture(
+ KeyVaultAdministrationClientOptions.ServiceVersion.V7_6_Preview_1,
KeyVaultAdministrationClientOptions.ServiceVersion.V7_5,
KeyVaultAdministrationClientOptions.ServiceVersion.V7_4,
KeyVaultAdministrationClientOptions.ServiceVersion.V7_3,
From e69b95f90993f8984b255724630edca7d84d6771 Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Tue, 23 Jul 2024 14:53:35 -0700
Subject: [PATCH 08/37] Export API
---
.../Azure.Security.KeyVault.Administration.netstandard2.0.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/api/Azure.Security.KeyVault.Administration.netstandard2.0.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/api/Azure.Security.KeyVault.Administration.netstandard2.0.cs
index 190260d78d90e..e38ee5d92b4a0 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/api/Azure.Security.KeyVault.Administration.netstandard2.0.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/api/Azure.Security.KeyVault.Administration.netstandard2.0.cs
@@ -43,7 +43,7 @@ public KeyVaultAccessControlClient(System.Uri vaultUri, Azure.Core.TokenCredenti
}
public partial class KeyVaultAdministrationClientOptions : Azure.Core.ClientOptions
{
- public KeyVaultAdministrationClientOptions(Azure.Security.KeyVault.Administration.KeyVaultAdministrationClientOptions.ServiceVersion version = Azure.Security.KeyVault.Administration.KeyVaultAdministrationClientOptions.ServiceVersion.V7_5) { }
+ public KeyVaultAdministrationClientOptions(Azure.Security.KeyVault.Administration.KeyVaultAdministrationClientOptions.ServiceVersion version = Azure.Security.KeyVault.Administration.KeyVaultAdministrationClientOptions.ServiceVersion.V7_6_Preview_1) { }
public bool DisableChallengeResourceVerification { get { throw null; } set { } }
public Azure.Security.KeyVault.Administration.KeyVaultAdministrationClientOptions.ServiceVersion Version { get { throw null; } }
public enum ServiceVersion
@@ -52,6 +52,7 @@ public enum ServiceVersion
V7_3 = 2,
V7_4 = 3,
V7_5 = 4,
+ V7_6_Preview_1 = 5,
}
}
public static partial class KeyVaultAdministrationModelFactory
From 2eaea1111d2fdd87870c7946a7e00a79428a49db Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Tue, 23 Jul 2024 14:59:58 -0700
Subject: [PATCH 09/37] Remove server-side fix from changelog
---
sdk/keyvault/Azure.Security.KeyVault.Keys/CHANGELOG.md | 2 --
1 file changed, 2 deletions(-)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Keys/CHANGELOG.md b/sdk/keyvault/Azure.Security.KeyVault.Keys/CHANGELOG.md
index e4aeb9c36c5c6..a09bc3172ade8 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Keys/CHANGELOG.md
+++ b/sdk/keyvault/Azure.Security.KeyVault.Keys/CHANGELOG.md
@@ -10,8 +10,6 @@
### Bugs Fixed
-- `KeyRotationPolicyAction` performs case-insensitive comparisons since Key Vault and Managed HSM return different cases for "rotate".
-
### Other Changes
- The default service version is now "V7_6_Preview_1".
From 912c317974c3d1aa87287f4cbc6831e777b7aa1b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonathan=20C=C3=A1rdenas?=
Date: Thu, 25 Jul 2024 13:46:50 -0700
Subject: [PATCH 10/37] Update
sdk/keyvault/Azure.Security.KeyVault.Certificates/CHANGELOG.md
---
sdk/keyvault/Azure.Security.KeyVault.Certificates/CHANGELOG.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Certificates/CHANGELOG.md b/sdk/keyvault/Azure.Security.KeyVault.Certificates/CHANGELOG.md
index 191162723fdba..80ee33722ef99 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Certificates/CHANGELOG.md
+++ b/sdk/keyvault/Azure.Security.KeyVault.Certificates/CHANGELOG.md
@@ -10,7 +10,7 @@
### Other Changes
-- The default service version is now "7.5-preview.1".
+- The default service version is now "V7_6_Preview_1".
## 4.6.0 (2024-02-14)
From f860bb7ee2619fc391117feec893f2c2efe73151 Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Thu, 25 Jul 2024 17:25:58 -0700
Subject: [PATCH 11/37] Add new endpoints definitions to readme
---
.../Azure.Security.KeyVault.Administration/README.md | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/README.md b/sdk/keyvault/Azure.Security.KeyVault.Administration/README.md
index c05c0ad094bde..53353d641e8e4 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/README.md
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/README.md
@@ -141,10 +141,16 @@ A `KeyVaultAccessControlClient` provides both synchronous and asynchronous opera
A `KeyVaultBackupClient` provides both synchronous and asynchronous operations for performing full key backups, full key restores, and selective key restores.
+### PreBackupOperation
+A `PreBackupOperation` represents a long-running operation that checks if it is possible to perform a full key backup.
+
### BackupOperation
A `BackupOperation` represents a long running operation for a full key backup.
+### PreRestoreOperation
+A `PreRestoreOperation` represents a long-running operation that checks if it is possible to perform a full key restore from a backup.
+
### RestoreOperation
A `RestoreOperation` represents a long running operation for both a full key and selective key restore.
@@ -179,7 +185,9 @@ The following section provides several code snippets using the `client` created
* [Getting a Role Assignment](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample1_RbacHelloWorldSync.md#getting-a-role-assignment)
* [Deleting a Role Assignment](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample1_RbacHelloWorldSync.md#deleting-a-role-assignment)
* Backup and restore
+ * [Pre-backup check for a Key Vault](# PENDING)
* [Performing a full key backup](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample1_BackupHelloWorldSync.md#performing-a-full-key-backup)
+ * [Pre-restore check for a Key Vault](# PENDING)
* [Performing a full key restore](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample1_BackupHelloWorldSync.md#performing-a-full-key-restore)
### Async examples
@@ -191,7 +199,9 @@ The following section provides several code snippets using the `client` created
* [Getting a Role Assignment](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample1_RbacHelloWorldAsync.md#getting-a-role-assignment)
* [Deleting a Role Assignment](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample1_RbacHelloWorldAsync.md#deleting-a-role-assignment)
* Backup and restore
+ * [Pre-backup check for a Key Vault](# PENDING)
* [Performing a full key backup](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample1_BackupHelloWorldAsync.md#performing-a-full-key-backup)
+ * [Pre-restore check for a Key Vault](# PENDING)
* [Performing a full key restore](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample1_BackupHelloWorldAsync.md#performing-a-full-key-restore)
## Troubleshooting
From 9f24db10be86f105d27db34043c7cd67b468db1e Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Thu, 25 Jul 2024 18:57:25 -0700
Subject: [PATCH 12/37] Add new Pre-backup methods
---
.../src/KeyVaultBackupClient.cs | 50 +++++++++++++++++++
.../src/KeyVaultBackupOperation.cs | 13 +++++
.../src/OperationHeadersExtensions.cs | 9 ++++
3 files changed, 72 insertions(+)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupClient.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupClient.cs
index 36a06b4f3bec3..def6deccb3d17 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupClient.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupClient.cs
@@ -123,6 +123,56 @@ public virtual KeyVaultBackupOperation StartBackup(Uri blobStorageUri, string sa
}
}
+ public virtual async Task StartPreBackupAsync(Uri blobStorageUri, string sasToken = default, CancellationToken cancellationToken = default)
+ {
+ using DiagnosticScope scope = _diagnostics.CreateScope($"{nameof(KeyVaultBackupClient)}.{nameof(StartBackup)}");
+ scope.Start();
+ try
+ {
+ var response = await _restClient.PreFullBackupAsync(
+ VaultUri.AbsoluteUri,
+ new PreBackupOperationParameters(
+ blobStorageUri.AbsoluteUri,
+ sasToken,
+ useManagedIdentity: sasToken == null
+ ),
+ cancellationToken).ConfigureAwait(false);
+
+ // Should this return a KeyVaultBackupOperation?
+ return new KeyVaultBackupOperation(this, response);
+ }
+ catch (Exception ex)
+ {
+ scope.Failed(ex);
+ throw;
+ }
+ }
+
+ public virtual KeyVaultBackupOperation StartPreBackup(Uri blobStorageUri, string sasToken = default, CancellationToken cancellationToken = default)
+ {
+ using DiagnosticScope scope = _diagnostics.CreateScope($"{nameof(KeyVaultBackupClient)}.{nameof(StartBackup)}");
+ scope.Start();
+ try
+ {
+ var response = _restClient.PreFullBackup(
+ VaultUri.AbsoluteUri,
+ new PreBackupOperationParameters(
+ blobStorageUri.AbsoluteUri,
+ sasToken,
+ useManagedIdentity: sasToken == null
+ ),
+ cancellationToken);
+
+ // Should this return a KeyVaultBackupOperation?
+ return new KeyVaultBackupOperation(this, response);
+ }
+ catch (Exception ex)
+ {
+ scope.Failed(ex);
+ throw;
+ }
+ }
+
///
/// Initiates a full key restore of the Key Vault.
///
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupOperation.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupOperation.cs
index a2cd70bbc61d1..9010d71e1ca89 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupOperation.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupOperation.cs
@@ -55,6 +55,19 @@ internal KeyVaultBackupOperation(KeyVaultBackupClient client, ResponseWithHeader
_id = response.Headers.JobId() ?? throw new InvalidOperationException("The response does not contain an Id");
}
+ ///
+ /// Initializes a new instance of a KeyVaultBackupOperation.
+ ///
+ /// An instance of .
+ /// The returned from or .
+ ///
+ internal KeyVaultBackupOperation(KeyVaultBackupClient client, ResponseWithHeaders response){
+ _client = client;
+ _response = response;
+ _retryAfterSeconds = (int)response.Headers.RetryAfter;
+ _id = response.Headers.JobId() ?? throw new InvalidOperationException("The response does not contain an Id");
+ }
+
///
/// Initializes a new instance of a KeyVaultBackupOperation for mocking purposes.
///
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/OperationHeadersExtensions.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/OperationHeadersExtensions.cs
index aa3687c4c5f46..ee44de81fcba8 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/OperationHeadersExtensions.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/OperationHeadersExtensions.cs
@@ -16,6 +16,15 @@ public static string JobId(this AzureSecurityKeyVaultAdministrationFullBackupHea
return GetJobIdFromAzureAsyncOperation(header.AzureAsyncOperation);
}
+ ///
+ /// Extracts the operation JobId from the AzureAsyncOperation.
+ ///
+ /// The operation JobId.
+ public static string JobId(this AzureSecurityKeyVaultAdministrationPreFullBackupHeaders header)
+ {
+ return GetJobIdFromAzureAsyncOperation(header.AzureAsyncOperation);
+ }
+
///
/// Extracts the operation JobId from the AzureAsyncOperation.
///
From eaeaffc9fc2d4459536395316e5a19e6600d34b1 Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Mon, 29 Jul 2024 02:27:15 -0700
Subject: [PATCH 13/37] Documentation for PreBackup methods
---
.../src/KeyVaultBackupClient.cs | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupClient.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupClient.cs
index def6deccb3d17..fec1c94784523 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupClient.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupClient.cs
@@ -123,6 +123,13 @@ public virtual KeyVaultBackupOperation StartBackup(Uri blobStorageUri, string sa
}
}
+ ///
+ /// Initiates a pre-backup check on the Key Vault. This operation checks if it is possible to back up the entire collection of keys from a Key Vault.
+ ///
+ /// The for the blob storage resource.
+ /// Optional Shared Access Signature (SAS) token to authorize access to the blob. If null, Managed Identity will be used to authenticate instead.
+ /// A controlling the request lifetime.
+ /// A representing the result of the asynchronous operation.
public virtual async Task StartPreBackupAsync(Uri blobStorageUri, string sasToken = default, CancellationToken cancellationToken = default)
{
using DiagnosticScope scope = _diagnostics.CreateScope($"{nameof(KeyVaultBackupClient)}.{nameof(StartBackup)}");
@@ -147,7 +154,14 @@ public virtual async Task StartPreBackupAsync(Uri blobS
throw;
}
}
-
+
+ ///
+ /// Initiates a pre-backup check on the Key Vault. This operation checks if it is possible to back up the entire collection of keys from a Key Vault.
+ ///
+ /// The for the blob storage resource.
+ ///
+ ///
+ /// A representing the result of the operation.
public virtual KeyVaultBackupOperation StartPreBackup(Uri blobStorageUri, string sasToken = default, CancellationToken cancellationToken = default)
{
using DiagnosticScope scope = _diagnostics.CreateScope($"{nameof(KeyVaultBackupClient)}.{nameof(StartBackup)}");
From a8e8abac0eda06f881750b680627c2fc375f07e9 Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Mon, 29 Jul 2024 22:22:36 -0700
Subject: [PATCH 14/37] Update method names in KeyVaultBackupClient for clarity
---
.../src/KeyVaultBackupClient.cs | 4 ++--
.../src/OperationHeadersExtensions.cs | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupClient.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupClient.cs
index fec1c94784523..d9d2331af0888 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupClient.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupClient.cs
@@ -132,7 +132,7 @@ public virtual KeyVaultBackupOperation StartBackup(Uri blobStorageUri, string sa
/// A representing the result of the asynchronous operation.
public virtual async Task StartPreBackupAsync(Uri blobStorageUri, string sasToken = default, CancellationToken cancellationToken = default)
{
- using DiagnosticScope scope = _diagnostics.CreateScope($"{nameof(KeyVaultBackupClient)}.{nameof(StartBackup)}");
+ using DiagnosticScope scope = _diagnostics.CreateScope($"{nameof(KeyVaultBackupClient)}.{nameof(StartPreBackupAsync)}");
scope.Start();
try
{
@@ -164,7 +164,7 @@ public virtual async Task StartPreBackupAsync(Uri blobS
/// A representing the result of the operation.
public virtual KeyVaultBackupOperation StartPreBackup(Uri blobStorageUri, string sasToken = default, CancellationToken cancellationToken = default)
{
- using DiagnosticScope scope = _diagnostics.CreateScope($"{nameof(KeyVaultBackupClient)}.{nameof(StartBackup)}");
+ using DiagnosticScope scope = _diagnostics.CreateScope($"{nameof(KeyVaultBackupClient)}.{nameof(StartPreBackup)}");
scope.Start();
try
{
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/OperationHeadersExtensions.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/OperationHeadersExtensions.cs
index ee44de81fcba8..5bd8412a06c93 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/OperationHeadersExtensions.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/OperationHeadersExtensions.cs
@@ -17,7 +17,7 @@ public static string JobId(this AzureSecurityKeyVaultAdministrationFullBackupHea
}
///
- /// Extracts the operation JobId from the AzureAsyncOperation.
+ /// Extracts the operation JobId from the AzureAsyncOperation.
///
/// The operation JobId.
public static string JobId(this AzureSecurityKeyVaultAdministrationPreFullBackupHeaders header)
From 058966602f96455edee6b43dd7ff3da498a29797 Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Tue, 30 Jul 2024 03:18:19 -0700
Subject: [PATCH 15/37] Add pre-restore methods
---
.../src/KeyVaultBackupClient.cs | 73 +++++++++++++++++++
.../src/KeyVaultRestoreOperation.cs | 38 ++++++----
.../src/OperationHeadersExtensions.cs | 9 +++
.../src/RestoreOperationInternal.cs | 5 ++
4 files changed, 112 insertions(+), 13 deletions(-)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupClient.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupClient.cs
index d9d2331af0888..09a5eb4852921 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupClient.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupClient.cs
@@ -227,6 +227,79 @@ public virtual async Task StartRestoreAsync(Uri folder
}
}
+ ///
+ /// Initiate a pre-restore check on a Key Vault. This operation checks if it is possible to restore the entire collection of keys from a Key Vault.
+ ///
+ ///
+ /// The for the blob storage resource, including the path to the blob container where the backup resides.
+ /// This would be the exact value that is returned as the result of a .
+ /// An example Uri may look like the following: https://contoso.blob.core.windows.net/backup/mhsm-contoso-2020090117323313.
+ ///
+ /// Optional Shared Access Signature (SAS) token to authorize access to the blob. If null, Managed Identity will be used to authenticate instead.
+ /// A controlling the request lifetime.
+ /// A representing the result of the asynchronous operation.
+ public virtual async Task StartPreRestoreAsync(Uri folderUri, string sasToken = default, CancellationToken cancellationToken = default)
+ {
+ using DiagnosticScope scope = _diagnostics.CreateScope($"{nameof(KeyVaultBackupClient)}.{nameof(StartRestore)}");
+ scope.Start();
+ try
+ {
+ // Get the folder name from the backupBlobUri returned from a previous BackupOperation
+ ParseFolderName(folderUri, out string containerUriString, out string folderName);
+
+ var response = await _restClient.PreFullRestoreOperationAsync(
+ VaultUri.AbsoluteUri,
+ new PreRestoreOperationParameters(
+ new SASTokenParameter(containerUriString, sasToken),
+ folderUri.AbsoluteUri
+ ),
+ cancellationToken).ConfigureAwait(false);
+
+ return new KeyVaultRestoreOperation(this, response);
+ }
+ catch (Exception ex)
+ {
+ scope.Failed(ex);
+ throw;
+ }
+ }
+
+ ///
+ /// Initiate a pre-restore check on a Key Vault. This operation checks if it is possible to restore the entire collection of keys from a Key Vault.
+ ///
+ ///
+ /// The for the blob storage resource, including the path to the blob container where the backup resides.
+ /// This would be the exact value that is returned as the result of a .
+ /// An example Uri path may look like the following: https://contoso.blob.core.windows.net/backup/mhsm-contoso-2020090117323313.
+ ///
+ /// Optional Shared Access Signature (SAS) token to authorize access to the blob. If null, Managed Identity will be used to authenticate instead.
+ /// A controlling the request lifetime.
+ /// A representing the result of the asynchronous operation.
+ public virtual KeyVaultRestoreOperation StartPreRestore(Uri folderUri, string sasToken = default, CancellationToken cancellationToken = default)
+ {
+ using DiagnosticScope scope = _diagnostics.CreateScope($"{nameof(KeyVaultBackupClient)}.{nameof(StartRestore)}");
+ scope.Start();
+ try
+ {
+ // Get the folder name from the backupBlobUri returned from a previous BackupOperation
+ ParseFolderName(folderUri, out string containerUriString, out string folderName);
+
+ var response = _restClient.PreFullRestoreOperation(
+ VaultUri.AbsoluteUri,
+ new PreRestoreOperationParameters(
+ new SASTokenParameter(containerUriString, sasToken),
+ folderUri.AbsoluteUri
+ ),
+ cancellationToken);
+ return new KeyVaultRestoreOperation(this, response);
+ }
+ catch (Exception ex)
+ {
+ scope.Failed(ex);
+ throw;
+ }
+ }
+
///
/// Initiates a full key restore of the Key Vault.
///
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultRestoreOperation.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultRestoreOperation.cs
index d862a119c32e0..983af308b946d 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultRestoreOperation.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultRestoreOperation.cs
@@ -15,6 +15,7 @@ namespace Azure.Security.KeyVault.Administration
public class KeyVaultRestoreOperation : Operation
{
internal readonly RestoreOperationInternal _operationInternal;
+ internal readonly RestoreOperationInternal _preOperationInternal;
///
/// Creates an instance of a KeyVaultRestoreOperation from a previously started operation. , ,
@@ -40,6 +41,19 @@ internal KeyVaultRestoreOperation(KeyVaultBackupClient client, ResponseWithHeade
_operationInternal = new RestoreOperationInternal(client, response);
}
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of .
+ /// The returned from or .
+ internal KeyVaultRestoreOperation(KeyVaultBackupClient client, ResponseWithHeaders response)
+ {
+ var operation = new RestoreOperationInternal(client, response);
+ _preOperationInternal = operation;
+
+ // _operationInternal = (RestoreOperationInternal)(object)operation;
+ }
+
///
/// Initializes a new instance of a KeyVaultRestoreOperation for mocking purposes.
///
@@ -58,41 +72,39 @@ protected KeyVaultRestoreOperation() {}
///
/// The start time of the restore operation.
///
- public DateTimeOffset? StartTime => _operationInternal.StartTime;
+ public DateTimeOffset? StartTime => _operationInternal.StartTime ?? _preOperationInternal.StartTime;
///
/// The end time of the restore operation.
///
- public DateTimeOffset? EndTime => _operationInternal.EndTime;
+ public DateTimeOffset? EndTime => _operationInternal.EndTime ?? _preOperationInternal.EndTime;
///
- public override string Id => _operationInternal.Id;
-
+ public override string Id => _operationInternal.Id ?? _preOperationInternal.Id;
///
- public override KeyVaultRestoreResult Value => _operationInternal.Value;
+ public override KeyVaultRestoreResult Value => _operationInternal.Value?? _preOperationInternal.Value;
///
- public override bool HasCompleted => _operationInternal.HasCompleted;
+ public override bool HasCompleted => _operationInternal is null? _preOperationInternal.HasCompleted: _operationInternal.HasCompleted;
///
- public override bool HasValue => _operationInternal.HasValue;
+ public override bool HasValue => _operationInternal is null? _preOperationInternal.HasValue: _operationInternal.HasValue;
///
- public override Response GetRawResponse() => _operationInternal.GetRawResponse();
+ public override Response GetRawResponse() => _operationInternal is null? _preOperationInternal.GetRawResponse(): _operationInternal.GetRawResponse();
///
- public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operationInternal.UpdateStatus(cancellationToken);
+ public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operationInternal is null? _preOperationInternal.UpdateStatus(cancellationToken): _operationInternal.UpdateStatus(cancellationToken);
///
- public override async ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) =>
- await _operationInternal.UpdateStatusAsync(cancellationToken).ConfigureAwait(false);
+ public override async ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operationInternal is null? await _preOperationInternal.UpdateStatusAsync(cancellationToken).ConfigureAwait(false): await _operationInternal.UpdateStatusAsync(cancellationToken).ConfigureAwait(false);
///
public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) =>
- _operationInternal.WaitForCompletionAsync(cancellationToken);
+ _operationInternal is null? _preOperationInternal.WaitForCompletionAsync(cancellationToken): _operationInternal.WaitForCompletionAsync(cancellationToken);
///
public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken) =>
- _operationInternal.WaitForCompletionAsync(pollingInterval, cancellationToken);
+ _operationInternal is null? _preOperationInternal.WaitForCompletionAsync(pollingInterval, cancellationToken): _operationInternal.WaitForCompletionAsync(pollingInterval, cancellationToken);
}
}
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/OperationHeadersExtensions.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/OperationHeadersExtensions.cs
index 5bd8412a06c93..dba73a3eb4438 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/OperationHeadersExtensions.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/OperationHeadersExtensions.cs
@@ -25,6 +25,15 @@ public static string JobId(this AzureSecurityKeyVaultAdministrationPreFullBackup
return GetJobIdFromAzureAsyncOperation(header.AzureAsyncOperation);
}
+ ///
+ /// Extracts the operation JobId from the AzureAsyncOperation.
+ ///
+ /// The operation JobId.
+ public static string JobId(this AzureSecurityKeyVaultAdministrationPreFullRestoreOperationHeaders header)
+ {
+ return GetJobIdFromAzureAsyncOperation(header.AzureAsyncOperation);
+ }
+
///
/// Extracts the operation JobId from the AzureAsyncOperation.
///
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/RestoreOperationInternal.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/RestoreOperationInternal.cs
index dfff9a1866469..bfb7d460b44bd 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/RestoreOperationInternal.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/RestoreOperationInternal.cs
@@ -65,6 +65,11 @@ internal RestoreOperationInternal(KeyVaultBackupClient client, ResponseWithHeade
_id = selectiveRestoreHeaders.Headers.JobId() ?? throw new InvalidOperationException("The response does not contain an Id");
_retryAfterSeconds = selectiveRestoreHeaders.Headers.RetryAfter;
}
+ else if (response is ResponseWithHeaders preRestoreHeaders)
+ {
+ _id = preRestoreHeaders.Headers.JobId() ?? throw new InvalidOperationException("The response does not contain an Id");
+ _retryAfterSeconds = (int)preRestoreHeaders.Headers.RetryAfter;
+ }
else
{
throw new ArgumentException("Invalid header type", nameof(response));
From 2e62d13681061a73e29758df53f3dcc1f7ab8dbf Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Tue, 30 Jul 2024 03:18:34 -0700
Subject: [PATCH 16/37] Export API
---
.../Azure.Security.KeyVault.Administration.netstandard2.0.cs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/api/Azure.Security.KeyVault.Administration.netstandard2.0.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/api/Azure.Security.KeyVault.Administration.netstandard2.0.cs
index e38ee5d92b4a0..951cfd7661d16 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/api/Azure.Security.KeyVault.Administration.netstandard2.0.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/api/Azure.Security.KeyVault.Administration.netstandard2.0.cs
@@ -80,6 +80,10 @@ public KeyVaultBackupClient(System.Uri vaultUri, Azure.Core.TokenCredential cred
public virtual System.Uri VaultUri { get { throw null; } }
public virtual Azure.Security.KeyVault.Administration.KeyVaultBackupOperation StartBackup(System.Uri blobStorageUri, string sasToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task StartBackupAsync(System.Uri blobStorageUri, string sasToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Security.KeyVault.Administration.KeyVaultBackupOperation StartPreBackup(System.Uri blobStorageUri, string sasToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual System.Threading.Tasks.Task StartPreBackupAsync(System.Uri blobStorageUri, string sasToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Security.KeyVault.Administration.KeyVaultRestoreOperation StartPreRestore(System.Uri folderUri, string sasToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual System.Threading.Tasks.Task StartPreRestoreAsync(System.Uri folderUri, string sasToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Security.KeyVault.Administration.KeyVaultRestoreOperation StartRestore(System.Uri folderUri, string sasToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task StartRestoreAsync(System.Uri folderUri, string sasToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Security.KeyVault.Administration.KeyVaultSelectiveKeyRestoreOperation StartSelectiveKeyRestore(string keyName, System.Uri folderUri, string sasToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
From 87794e0e81e18856d0d1c6caa05761fa70e55d63 Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Thu, 1 Aug 2024 12:55:44 -0700
Subject: [PATCH 17/37] Use a flag to handle different headers in
RestoreOperation
---
.../src/KeyVaultRestoreOperation.cs | 30 +++++++++----------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultRestoreOperation.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultRestoreOperation.cs
index 983af308b946d..0106c40191e42 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultRestoreOperation.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultRestoreOperation.cs
@@ -17,6 +17,8 @@ public class KeyVaultRestoreOperation : Operation
internal readonly RestoreOperationInternal _operationInternal;
internal readonly RestoreOperationInternal _preOperationInternal;
+ private bool _isPreOperation = false;
+
///
/// Creates an instance of a KeyVaultRestoreOperation from a previously started operation. , ,
/// , or must be called
@@ -48,10 +50,8 @@ internal KeyVaultRestoreOperation(KeyVaultBackupClient client, ResponseWithHeade
/// The returned from or .
internal KeyVaultRestoreOperation(KeyVaultBackupClient client, ResponseWithHeaders response)
{
- var operation = new RestoreOperationInternal(client, response);
- _preOperationInternal = operation;
-
- // _operationInternal = (RestoreOperationInternal)(object)operation;
+ _isPreOperation = true;
+ _preOperationInternal = new RestoreOperationInternal(client, response);
}
///
@@ -72,39 +72,39 @@ protected KeyVaultRestoreOperation() {}
///
/// The start time of the restore operation.
///
- public DateTimeOffset? StartTime => _operationInternal.StartTime ?? _preOperationInternal.StartTime;
+ public DateTimeOffset? StartTime => _isPreOperation? _preOperationInternal.StartTime : _operationInternal.StartTime;
///
/// The end time of the restore operation.
///
- public DateTimeOffset? EndTime => _operationInternal.EndTime ?? _preOperationInternal.EndTime;
+ public DateTimeOffset? EndTime => _isPreOperation? _preOperationInternal.EndTime : _operationInternal.EndTime;
///
- public override string Id => _operationInternal.Id ?? _preOperationInternal.Id;
+ public override string Id => _isPreOperation? _preOperationInternal.Id : _operationInternal.Id;
///
- public override KeyVaultRestoreResult Value => _operationInternal.Value?? _preOperationInternal.Value;
+ public override KeyVaultRestoreResult Value => _isPreOperation? _preOperationInternal.Value : _operationInternal.Value;
///
- public override bool HasCompleted => _operationInternal is null? _preOperationInternal.HasCompleted: _operationInternal.HasCompleted;
+ public override bool HasCompleted => _isPreOperation? _preOperationInternal.HasCompleted: _operationInternal.HasCompleted;
///
- public override bool HasValue => _operationInternal is null? _preOperationInternal.HasValue: _operationInternal.HasValue;
+ public override bool HasValue => _isPreOperation? _preOperationInternal.HasValue: _operationInternal.HasValue;
///
- public override Response GetRawResponse() => _operationInternal is null? _preOperationInternal.GetRawResponse(): _operationInternal.GetRawResponse();
+ public override Response GetRawResponse() => _isPreOperation? _preOperationInternal.GetRawResponse(): _operationInternal.GetRawResponse();
///
- public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operationInternal is null? _preOperationInternal.UpdateStatus(cancellationToken): _operationInternal.UpdateStatus(cancellationToken);
+ public override Response UpdateStatus(CancellationToken cancellationToken = default) => _isPreOperation? _preOperationInternal.UpdateStatus(cancellationToken): _operationInternal.UpdateStatus(cancellationToken);
///
- public override async ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operationInternal is null? await _preOperationInternal.UpdateStatusAsync(cancellationToken).ConfigureAwait(false): await _operationInternal.UpdateStatusAsync(cancellationToken).ConfigureAwait(false);
+ public override async ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _isPreOperation? await _preOperationInternal.UpdateStatusAsync(cancellationToken).ConfigureAwait(false): await _operationInternal.UpdateStatusAsync(cancellationToken).ConfigureAwait(false);
///
public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) =>
- _operationInternal is null? _preOperationInternal.WaitForCompletionAsync(cancellationToken): _operationInternal.WaitForCompletionAsync(cancellationToken);
+ _isPreOperation? _preOperationInternal.WaitForCompletionAsync(cancellationToken): _operationInternal.WaitForCompletionAsync(cancellationToken);
///
public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken) =>
- _operationInternal is null? _preOperationInternal.WaitForCompletionAsync(pollingInterval, cancellationToken): _operationInternal.WaitForCompletionAsync(pollingInterval, cancellationToken);
+ _isPreOperation? _preOperationInternal.WaitForCompletionAsync(pollingInterval, cancellationToken): _operationInternal.WaitForCompletionAsync(pollingInterval, cancellationToken);
}
}
From 1db8b35514a6188272b1acc8daffb4d31b5bbfea Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Thu, 1 Aug 2024 13:35:38 -0700
Subject: [PATCH 18/37] Update Administration Changelog
---
.../Azure.Security.KeyVault.Administration/CHANGELOG.md | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/CHANGELOG.md b/sdk/keyvault/Azure.Security.KeyVault.Administration/CHANGELOG.md
index 265085526e798..0c01fb474c976 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/CHANGELOG.md
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/CHANGELOG.md
@@ -3,12 +3,15 @@
## 4.5.0-beta.1 (Unreleased)
### Features Added
+- Added support for service API version `7.6-preview.1`.
+- New `StartPreRestoreAsync`, `StartPreRestore`, `StartPreBackupAsync` and `StartPreBackupAsync` methods available in the `KeyVaultBackupClient`.
### Breaking Changes
### Bugs Fixed
### Other Changes
+- The default service version is now "V7_6_Preview_1".
## 4.4.0 (2024-02-14)
From acb448bb00cf0b1fb8585db498e87157e475252d Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Thu, 1 Aug 2024 15:47:17 -0700
Subject: [PATCH 19/37] Add tests for Administration
---
.../tests/FullBackupClientLiveTests.cs | 29 ++++++++++++++
.../tests/samples/Sample1_BackupHelloWorld.cs | 40 +++++++++++++++++++
2 files changed, 69 insertions(+)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/FullBackupClientLiveTests.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/FullBackupClientLiveTests.cs
index 17087ce4e5519..dffb519dddd5e 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/FullBackupClientLiveTests.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/FullBackupClientLiveTests.cs
@@ -50,6 +50,35 @@ public async Task BackupAndRestore()
Assert.That(restoreOperation.HasValue, Is.True);
}
+ [RecordedTest]
+ public async Task PreBackupAndPreRestore()
+ {
+ var source = new CancellationTokenSource(Timeout);
+
+ UriBuilder builder = new UriBuilder(TestEnvironment.StorageUri);
+ builder.Path = BlobContainerName;
+
+ // Start the pre-backup operation.
+ KeyVaultBackupOperation preBackupOperation = await Client.StartPreBackupAsync(builder.Uri, "?" + SasToken, source.Token);
+
+ KeyVaultBackupResult preBackupResult = await preBackupOperation.WaitForCompletionAsync(source.Token);
+
+ await WaitForOperationAsync();
+
+ Assert.That(source.IsCancellationRequested, Is.False);
+ Assert.That(preBackupResult, Is.Not.Null);
+ Assert.That(preBackupOperation.HasValue, Is.True);
+
+ // Start the pre-restore operation.
+ KeyVaultRestoreOperation preRestoreOperation = await Client.StartPreRestoreAsync(preBackupResult.FolderUri, "?" + SasToken, source.Token);
+ KeyVaultRestoreResult preRestoreResult = await preRestoreOperation.WaitForCompletionAsync(source.Token);
+ await WaitForOperationAsync();
+
+ Assert.That(source.IsCancellationRequested, Is.False);
+ Assert.That(preRestoreResult, Is.Not.Null);
+ Assert.That(preRestoreOperation.HasValue, Is.True);
+ }
+
[RecordedTest]
[LiveOnly]
[Ignore("https://github.com/Azure/azure-sdk-for-net/issues/35614")]
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/samples/Sample1_BackupHelloWorld.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/samples/Sample1_BackupHelloWorld.cs
index 139819a4b0991..a630490c1acc4 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/samples/Sample1_BackupHelloWorld.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/samples/Sample1_BackupHelloWorld.cs
@@ -71,6 +71,46 @@ public async Task BackupAndRestoreSampleAsync()
await WaitForOperationAsync();
}
+ [RecordedTest]
+ [AsyncOnly]
+ public async Task PreBackupAndPreRestoreSampleAsync()
+ {
+ var blobStorageUrl = TestEnvironment.StorageUri;
+ var blobContainerName = BlobContainerName;
+ var sasToken = "?" + SasToken;
+
+ #region Snippet:HelloPreFullBackupAsync
+ // Create a Uri with the storage container
+ UriBuilder builder = new UriBuilder(blobStorageUrl)
+ {
+ Path = blobContainerName,
+ };
+
+ // Check for backup readiness.
+ KeyVaultBackupOperation backupOperation = await Client.StartPreBackupAsync(builder.Uri, sasToken);
+
+ // Wait for completion of the PreBackupOperation.
+ KeyVaultBackupResult backupResult = await backupOperation.WaitForCompletionAsync();
+
+ // Get the Uri for the location of your backup blob.
+ bool readyforBackup = backupResult.FolderUri != null;
+ #endregion
+
+ Assert.That(folderUri, Is.Not.Null);
+ Assert.That(backupOperation.HasValue, Is.True);
+
+ await WaitForOperationAsync();
+
+ #region Snippet:HelloPreFullRestoreAsync
+ // Check for restore readiness using the backupBlobUri returned from a previous BackupOperation.
+ KeyVaultRestoreOperation preRestoreOperation = await Client.StartPreRestoreAsync(folderUri, sasToken);
+
+ //
+
+
+ #endregion
+ }
+
[RecordedTest]
[SyncOnly]
public async Task BackupAndRestoreSampleSync()
From 438bdeb1e2538f3810409112c43589172d60b831 Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Thu, 1 Aug 2024 16:12:40 -0700
Subject: [PATCH 20/37] Update preBackup and preRestore tests
---
.../tests/FullBackupClientLiveTests.cs | 1 +
.../tests/samples/Sample1_BackupHelloWorld.cs | 29 +++++++++++++++----
2 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/FullBackupClientLiveTests.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/FullBackupClientLiveTests.cs
index dffb519dddd5e..5d087fb96f40a 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/FullBackupClientLiveTests.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/FullBackupClientLiveTests.cs
@@ -51,6 +51,7 @@ public async Task BackupAndRestore()
}
[RecordedTest]
+ [Ignore("Service is not ready yet")]
public async Task PreBackupAndPreRestore()
{
var source = new CancellationTokenSource(Timeout);
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/samples/Sample1_BackupHelloWorld.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/samples/Sample1_BackupHelloWorld.cs
index a630490c1acc4..23736ffcb30fb 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/samples/Sample1_BackupHelloWorld.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/samples/Sample1_BackupHelloWorld.cs
@@ -73,6 +73,7 @@ public async Task BackupAndRestoreSampleAsync()
[RecordedTest]
[AsyncOnly]
+ [Ignore("Service is not ready yet")]
public async Task PreBackupAndPreRestoreSampleAsync()
{
var blobStorageUrl = TestEnvironment.StorageUri;
@@ -90,10 +91,15 @@ public async Task PreBackupAndPreRestoreSampleAsync()
KeyVaultBackupOperation backupOperation = await Client.StartPreBackupAsync(builder.Uri, sasToken);
// Wait for completion of the PreBackupOperation.
- KeyVaultBackupResult backupResult = await backupOperation.WaitForCompletionAsync();
+ Response backupResult = await backupOperation.WaitForCompletionAsync();
- // Get the Uri for the location of your backup blob.
- bool readyforBackup = backupResult.FolderUri != null;
+ // Check if the PreBackupOperation has completed successfully.
+ Uri folderUri = backupOperation.HasValue ? backupResult.Value.FolderUri : null;
+
+ if (folderUri is null)
+ {
+ Console.WriteLine($"Backup operation failed. Status: {backupOperation.GetRawResponse().Status}, Reason: {backupOperation.GetRawResponse().ReasonPhrase}");
+ }
#endregion
Assert.That(folderUri, Is.Not.Null);
@@ -105,10 +111,23 @@ public async Task PreBackupAndPreRestoreSampleAsync()
// Check for restore readiness using the backupBlobUri returned from a previous BackupOperation.
KeyVaultRestoreOperation preRestoreOperation = await Client.StartPreRestoreAsync(folderUri, sasToken);
- //
-
+ // Wait for completion of the PreRestoreOperation.
+ Response preRestoreResult = await preRestoreOperation.WaitForCompletionAsync();
+ // Check if the PreRestoreOperation has completed successfully.
+ if (preRestoreOperation.HasValue)
+ {
+ Console.WriteLine($"Pre-restore operation completed successfully. Status: {preRestoreOperation.GetRawResponse().Status}");
+ }
+ else
+ {
+ Console.WriteLine($"Pre-restore operation failed. Status: {preRestoreOperation.GetRawResponse().Status}, Reason: {preRestoreOperation.GetRawResponse().ReasonPhrase}");
+ }
#endregion
+
+ Assert.That(preRestoreOperation.HasValue, Is.True);
+ Assert.That(preRestoreResult.Value.StartTime, Is.Not.EqualTo(default));
+ Assert.That(preRestoreResult.Value.EndTime, Is.Not.EqualTo(default));
}
[RecordedTest]
From ac3a59c57975c142cbd11673011bf62d3b1e2d0f Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Thu, 1 Aug 2024 17:00:44 -0700
Subject: [PATCH 21/37] Missing new version in CertificatesClientOptions
---
.../src/CertificateClientOptions.cs | 1 +
1 file changed, 1 insertion(+)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/CertificateClientOptions.cs b/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/CertificateClientOptions.cs
index c45d67166c78f..d90bf176b648c 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/CertificateClientOptions.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/CertificateClientOptions.cs
@@ -99,6 +99,7 @@ internal string GetVersionString()
ServiceVersion.V7_3 => "7.3",
ServiceVersion.V7_4 => "7.4",
ServiceVersion.V7_5 => "7.5",
+ ServiceVersion.V7_6_Preview_1 => "7.6-preview.1",
_ => throw new ArgumentException(Version.ToString()),
};
}
From 5347ae3328fc2492e0a107053e6711ef16c71d74 Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Thu, 1 Aug 2024 18:01:41 -0700
Subject: [PATCH 22/37] Re-record CertificateClientLiveTests
---
sdk/keyvault/Azure.Security.KeyVault.Certificates/assets.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Certificates/assets.json b/sdk/keyvault/Azure.Security.KeyVault.Certificates/assets.json
index 3d555e91ec263..ceae51646e6a2 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Certificates/assets.json
+++ b/sdk/keyvault/Azure.Security.KeyVault.Certificates/assets.json
@@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "net",
"TagPrefix": "net/keyvault/Azure.Security.KeyVault.Certificates",
- "Tag": "net/keyvault/Azure.Security.KeyVault.Certificates_320abaee9a"
+ "Tag": "net/keyvault/Azure.Security.KeyVault.Certificates_11a73707a2"
}
From f41951a13da63c26fa171a12f1cf27764a38391e Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Fri, 9 Aug 2024 16:45:05 -0700
Subject: [PATCH 23/37] Remove unninteded line in Keys Changelog
---
sdk/keyvault/Azure.Security.KeyVault.Keys/CHANGELOG.md | 2 --
1 file changed, 2 deletions(-)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Keys/CHANGELOG.md b/sdk/keyvault/Azure.Security.KeyVault.Keys/CHANGELOG.md
index a09bc3172ade8..5a8768d37b6e1 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Keys/CHANGELOG.md
+++ b/sdk/keyvault/Azure.Security.KeyVault.Keys/CHANGELOG.md
@@ -4,8 +4,6 @@
### Features Added
-- Added `KeyProperties.HsmPlatform` to get the underlying HSM platform.
-
### Breaking Changes
### Bugs Fixed
From 007cfbbdd44352561a3763821b806317ce92ff3c Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Fri, 9 Aug 2024 16:45:37 -0700
Subject: [PATCH 24/37] Improve admin changelod message and clean samples in
readme
---
.../Azure.Security.KeyVault.Administration/CHANGELOG.md | 2 +-
sdk/keyvault/Azure.Security.KeyVault.Administration/README.md | 4 ----
2 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/CHANGELOG.md b/sdk/keyvault/Azure.Security.KeyVault.Administration/CHANGELOG.md
index 0c01fb474c976..01b7fdb7c2505 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/CHANGELOG.md
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/CHANGELOG.md
@@ -4,7 +4,7 @@
### Features Added
- Added support for service API version `7.6-preview.1`.
-- New `StartPreRestoreAsync`, `StartPreRestore`, `StartPreBackupAsync` and `StartPreBackupAsync` methods available in the `KeyVaultBackupClient`.
+- Added new methods `StartPreRestoreAsync`, `StartPreRestore`, `StartPreBackupAsync`, and `StartPreBackupAsync` to the `KeyVaultBackupClient`.
### Breaking Changes
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/README.md b/sdk/keyvault/Azure.Security.KeyVault.Administration/README.md
index 53353d641e8e4..dc452003b702a 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/README.md
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/README.md
@@ -185,9 +185,7 @@ The following section provides several code snippets using the `client` created
* [Getting a Role Assignment](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample1_RbacHelloWorldSync.md#getting-a-role-assignment)
* [Deleting a Role Assignment](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample1_RbacHelloWorldSync.md#deleting-a-role-assignment)
* Backup and restore
- * [Pre-backup check for a Key Vault](# PENDING)
* [Performing a full key backup](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample1_BackupHelloWorldSync.md#performing-a-full-key-backup)
- * [Pre-restore check for a Key Vault](# PENDING)
* [Performing a full key restore](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample1_BackupHelloWorldSync.md#performing-a-full-key-restore)
### Async examples
@@ -199,9 +197,7 @@ The following section provides several code snippets using the `client` created
* [Getting a Role Assignment](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample1_RbacHelloWorldAsync.md#getting-a-role-assignment)
* [Deleting a Role Assignment](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample1_RbacHelloWorldAsync.md#deleting-a-role-assignment)
* Backup and restore
- * [Pre-backup check for a Key Vault](# PENDING)
* [Performing a full key backup](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample1_BackupHelloWorldAsync.md#performing-a-full-key-backup)
- * [Pre-restore check for a Key Vault](# PENDING)
* [Performing a full key restore](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/keyvault/Azure.Security.KeyVault.Administration/samples/Sample1_BackupHelloWorldAsync.md#performing-a-full-key-restore)
## Troubleshooting
From 328c2854fea8e160bd61092a1f08a886d4357ae3 Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Fri, 9 Aug 2024 16:45:58 -0700
Subject: [PATCH 25/37] nit changes
---
.../src/PreRestoreOperationParameters.cs | 1 +
.../tests/FullBackupClientLiveTests.cs | 1 -
.../tests/samples/Sample1_BackupHelloWorld.cs | 1 -
3 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/PreRestoreOperationParameters.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/PreRestoreOperationParameters.cs
index 009ea64b3238b..aac8dd35968d8 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/PreRestoreOperationParameters.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/PreRestoreOperationParameters.cs
@@ -3,6 +3,7 @@
namespace Azure.Security.KeyVault.Administration.Models
{
+ // Transform the PreBackupOperationParameters model to an internal class.
internal partial class PreRestoreOperationParameters
{ }
}
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/FullBackupClientLiveTests.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/FullBackupClientLiveTests.cs
index 5d087fb96f40a..dffb519dddd5e 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/FullBackupClientLiveTests.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/FullBackupClientLiveTests.cs
@@ -51,7 +51,6 @@ public async Task BackupAndRestore()
}
[RecordedTest]
- [Ignore("Service is not ready yet")]
public async Task PreBackupAndPreRestore()
{
var source = new CancellationTokenSource(Timeout);
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/samples/Sample1_BackupHelloWorld.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/samples/Sample1_BackupHelloWorld.cs
index 23736ffcb30fb..e17c440396f86 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/samples/Sample1_BackupHelloWorld.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/samples/Sample1_BackupHelloWorld.cs
@@ -73,7 +73,6 @@ public async Task BackupAndRestoreSampleAsync()
[RecordedTest]
[AsyncOnly]
- [Ignore("Service is not ready yet")]
public async Task PreBackupAndPreRestoreSampleAsync()
{
var blobStorageUrl = TestEnvironment.StorageUri;
From 1c7640c53eed36f4db219d72d4e1fc271f73f508 Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Thu, 15 Aug 2024 15:26:09 -0700
Subject: [PATCH 26/37] Format Changelog md files
---
.../CHANGELOG.md | 6 ++++--
.../CHANGELOG.md | 8 ++++----
.../Azure.Security.KeyVault.Keys/CHANGELOG.md | 6 +++---
.../CHANGELOG.md | 17 ++++++++++-------
4 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/CHANGELOG.md b/sdk/keyvault/Azure.Security.KeyVault.Administration/CHANGELOG.md
index 01b7fdb7c2505..4b08ca6035e40 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/CHANGELOG.md
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/CHANGELOG.md
@@ -3,6 +3,7 @@
## 4.5.0-beta.1 (Unreleased)
### Features Added
+
- Added support for service API version `7.6-preview.1`.
- Added new methods `StartPreRestoreAsync`, `StartPreRestore`, `StartPreBackupAsync`, and `StartPreBackupAsync` to the `KeyVaultBackupClient`.
@@ -11,6 +12,7 @@
### Bugs Fixed
### Other Changes
+
- The default service version is now "V7_6_Preview_1".
## 4.4.0 (2024-02-14)
@@ -86,8 +88,8 @@ The following changes are only breaking from the previous beta. They are not bre
### Breaking Changes
- Verify the challenge resource matches the vault domain.
- This should affect few customers who can set `KeyVaultAdministrationClientOptions.DisableChallengeResourceVerification` to `true` to disable.
- See https://aka.ms/azsdk/blog/vault-uri for more information.
+ This should affect few customers who can set `KeyVaultAdministrationClientOptions.DisableChallengeResourceVerification` to `true` to disable.
+ See for more information.
## 4.1.0 (2022-03-24)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Certificates/CHANGELOG.md b/sdk/keyvault/Azure.Security.KeyVault.Certificates/CHANGELOG.md
index 80ee33722ef99..917ca4d22e1da 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Certificates/CHANGELOG.md
+++ b/sdk/keyvault/Azure.Security.KeyVault.Certificates/CHANGELOG.md
@@ -19,7 +19,7 @@ Changes from both the last release and the last beta include:
### Features Added
- Added `CertificateProperties.X509ThumbprintString` to return the hexadecimal string representation of the SHA-1 hash of the certificate.
- `CertificateProperties.X509Thumbprint` has been hidden but is still available.
+ `CertificateProperties.X509Thumbprint` has been hidden but is still available.
### Breaking Changes
@@ -48,7 +48,7 @@ Changes from both the last release and the last beta include:
### Features Added
- Added `CertificateProperties.X509ThumbprintString` to return the hexadecimal string representation of the SHA-1 hash of the certificate.
- `CertificateProperties.X509Thumbprint` has been hidden but is still available.
+ `CertificateProperties.X509Thumbprint` has been hidden but is still available.
### Breaking Changes
@@ -96,8 +96,8 @@ Changes from both the last release and the last beta include:
### Breaking Changes
- Verify the challenge resource matches the vault domain.
- This should affect few customers who can set `CertificateClientOptions.DisableChallengeResourceVerification` to `true` to disable.
- See https://aka.ms/azsdk/blog/vault-uri for more information.
+ This should affect few customers who can set `CertificateClientOptions.DisableChallengeResourceVerification` to `true` to disable.
+ See for more information.
## 4.3.0 (2022-03-24)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Keys/CHANGELOG.md b/sdk/keyvault/Azure.Security.KeyVault.Keys/CHANGELOG.md
index 5a8768d37b6e1..1734a9546135d 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Keys/CHANGELOG.md
+++ b/sdk/keyvault/Azure.Security.KeyVault.Keys/CHANGELOG.md
@@ -108,7 +108,7 @@ The following changes are only breaking from the previous beta. They are not bre
- Verify the challenge resource matches the vault domain.
This should affect few customers who can set `KeyClientOptions.DisableChallengeResourceVerification` or `CryptographyClientOptions.DisableChallengeResourceVerification` to `true` to disable.
- See https://aka.ms/azsdk/blog/vault-uri for more information.
+ See for more information.
## 4.3.0 (2022-03-24)
@@ -399,7 +399,7 @@ Changes from both the last release and the last beta include:
Version 4.0.0-preview.1 is the first preview of our efforts to create a user-friendly client library for Azure Key Vault. For more information about
preview releases of other Azure SDK libraries, please visit
-https://aka.ms/azure-sdk-preview1-net.
+.
This library is not a direct replacement for `Microsoft.Azure.KeyVault`. Applications
using that library would require code changes to use `Azure.Security.KeyVault.Keys`.
@@ -424,7 +424,7 @@ only).
[Azure Identity documentation](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/identity/Azure.Identity)
for more information
-### `Microsoft.Azure.KeyVault` features not implemented in this release:
+### `Microsoft.Azure.KeyVault` features not implemented in this release
- Certificate management APIs
- Cryptographic operations, e.g. sign, un/wrap, verify, en- and
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Secrets/CHANGELOG.md b/sdk/keyvault/Azure.Security.KeyVault.Secrets/CHANGELOG.md
index 8294e5c5e7aab..6e2354363b267 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Secrets/CHANGELOG.md
+++ b/sdk/keyvault/Azure.Security.KeyVault.Secrets/CHANGELOG.md
@@ -76,7 +76,7 @@ Changes from both the last release and the last beta include:
- Verify the challenge resource matches the vault domain.
This should affect few customers who can set `SecretClientOptions.DisableChallengeResourceVerification` to `true` to disable.
- See https://aka.ms/azsdk/blog/vault-uri for more information.
+ See for more information.
## 4.3.0 (2022-03-24)
@@ -220,14 +220,14 @@ Changes from both the last release and the last beta include:
- `SecretClient.DeleteSecret` has been renamed to `SecretClient.StartDeleteSecret` and now returns a `DeleteSecretOperation` to track this long-running operation.
- `SecretClient.RecoverDeletedSecret` has been renamed to `SecretClient.StartRecoverDeletedSecret` and now returns a `RecoverDeletedSecretOperation` to track this long-running operation.
-### Major changes
+### Major changes
- Updated to work with the 1.0.0 release versions of Azure.Core and Azure.Identity.
- `KeyModelFactory` added to create mocks of model types for testing.
## 4.0.0-preview.5 (2019-10-07)
-### Breaking changes
+### Breaking changes
- `SecretBase` has been renamed to `SecretProperties`.
- `Secret` and `DeletedSecret` no longer extend `SecretProperties`, but instead contain a `SecretProperties` property named `Properties`.
@@ -236,9 +236,10 @@ Changes from both the last release and the last beta include:
- All methods in `SecretClient` now include the word "Secret" consistent with `KeyClient` and `CertificateClient`.
## 4.0.0-preview.1 (2019-06-28)
+
Version 4.0.0-preview.1 is the first preview of our efforts to create a user-friendly client library for Azure Key Vault. For more information about
preview releases of other Azure SDK libraries, please visit
-https://aka.ms/azure-sdk-preview1-net.
+.
This library is not a direct replacement for `Microsoft.Azure.KeyVault`. Applications
using that library would require code changes to use `Azure.Security.KeyVault.Secrets`.
@@ -249,9 +250,10 @@ and
demonstrate the new API.
### Major changes from `Microsoft.Azure.KeyVault`
+
- Packages scoped by functionality
- - `Azure.Security.KeyVault.Secrets` contains a client for secret operations.
- - `Azure.Security.KeyVault.Keys` contains a client for key operations.
+ - `Azure.Security.KeyVault.Secrets` contains a client for secret operations.
+ - `Azure.Security.KeyVault.Keys` contains a client for key operations.
- Client instances are scoped to vaults (an instance interacts with one vault
only).
- Asynchronous and synchronous APIs in the `Azure.Security.KeyVault.Secrets` package.
@@ -262,7 +264,8 @@ only).
[Azure Identity documentation](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/identity/Azure.Identity)
for more information
-### `Microsoft.Azure.KeyVault` features not implemented in this release:
+### `Microsoft.Azure.KeyVault` features not implemented in this release
+
- Certificate management APIs
- National cloud support. This release supports public global cloud vaults,
e.g. https://{vault-name}.vault.azure.net
From afd513b040153acae3485aee42fe0e9e6d7f327e Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Thu, 15 Aug 2024 16:31:19 -0700
Subject: [PATCH 27/37] Add null argument checks in KeyVaultBackupClient
methods and document exceptions
---
.../src/KeyVaultBackupClient.cs | 24 +++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupClient.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupClient.cs
index 09a5eb4852921..e9131ec343fe6 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupClient.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupClient.cs
@@ -129,9 +129,14 @@ public virtual KeyVaultBackupOperation StartBackup(Uri blobStorageUri, string sa
/// The for the blob storage resource.
/// Optional Shared Access Signature (SAS) token to authorize access to the blob. If null, Managed Identity will be used to authenticate instead.
/// A controlling the request lifetime.
+ /// or is null.
+ /// The server returned an error. See for details returned from the server.
/// A representing the result of the asynchronous operation.
public virtual async Task StartPreBackupAsync(Uri blobStorageUri, string sasToken = default, CancellationToken cancellationToken = default)
{
+ Argument.AssertNotNull(blobStorageUri, nameof(blobStorageUri));
+ Argument.AssertNotNull(sasToken, nameof(sasToken));
+
using DiagnosticScope scope = _diagnostics.CreateScope($"{nameof(KeyVaultBackupClient)}.{nameof(StartPreBackupAsync)}");
scope.Start();
try
@@ -159,11 +164,16 @@ public virtual async Task StartPreBackupAsync(Uri blobS
/// Initiates a pre-backup check on the Key Vault. This operation checks if it is possible to back up the entire collection of keys from a Key Vault.
///
/// The for the blob storage resource.
- ///
- ///
+ /// Optional Shared Access Signature (SAS) token to authorize access to the blob. If null, Managed Identity will be used to authenticate instead.
+ /// A controlling the request lifetime.
+ /// or is null.
+ /// The server returned an error. See for details returned from the server.
/// A representing the result of the operation.
public virtual KeyVaultBackupOperation StartPreBackup(Uri blobStorageUri, string sasToken = default, CancellationToken cancellationToken = default)
{
+ Argument.AssertNotNull(blobStorageUri, nameof(blobStorageUri));
+ Argument.AssertNotNull(sasToken, nameof(sasToken));
+
using DiagnosticScope scope = _diagnostics.CreateScope($"{nameof(KeyVaultBackupClient)}.{nameof(StartPreBackup)}");
scope.Start();
try
@@ -237,9 +247,14 @@ public virtual async Task StartRestoreAsync(Uri folder
///
/// Optional Shared Access Signature (SAS) token to authorize access to the blob. If null, Managed Identity will be used to authenticate instead.
/// A controlling the request lifetime.
+ /// or is null.
+ /// The server returned an error. See for details returned from the server.
/// A representing the result of the asynchronous operation.
public virtual async Task StartPreRestoreAsync(Uri folderUri, string sasToken = default, CancellationToken cancellationToken = default)
{
+ Argument.AssertNotNull(folderUri, nameof(folderUri));
+ Argument.AssertNotNull(sasToken, nameof(sasToken));
+
using DiagnosticScope scope = _diagnostics.CreateScope($"{nameof(KeyVaultBackupClient)}.{nameof(StartRestore)}");
scope.Start();
try
@@ -274,9 +289,14 @@ public virtual async Task StartPreRestoreAsync(Uri fol
///
/// Optional Shared Access Signature (SAS) token to authorize access to the blob. If null, Managed Identity will be used to authenticate instead.
/// A controlling the request lifetime.
+ /// or is null.
+ /// The server returned an error. See for details returned from the server.
/// A representing the result of the asynchronous operation.
public virtual KeyVaultRestoreOperation StartPreRestore(Uri folderUri, string sasToken = default, CancellationToken cancellationToken = default)
{
+ Argument.AssertNotNull(folderUri, nameof(folderUri));
+ Argument.AssertNotNull(sasToken, nameof(sasToken));
+
using DiagnosticScope scope = _diagnostics.CreateScope($"{nameof(KeyVaultBackupClient)}.{nameof(StartRestore)}");
scope.Start();
try
From c1d637085b818dc39c398417d3d9d21d76c17085 Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Fri, 16 Aug 2024 14:55:09 -0700
Subject: [PATCH 28/37] Introducing the KeyVaultPreBackupOperation and
KeyVaultPreRestoreOperation classes.
---
.../src/KeyVaultBackupClient.cs | 24 +--
.../src/KeyVaultBackupOperation.cs | 13 --
.../src/KeyVaultPreBackupOperation.cs | 177 ++++++++++++++++++
.../src/KeyVaultPreRestoreOperation.cs | 95 ++++++++++
.../src/KeyVaultRestoreOperation.cs | 36 ++--
.../tests/FullBackupClientLiveTests.cs | 4 +-
.../tests/samples/Sample1_BackupHelloWorld.cs | 4 +-
7 files changed, 299 insertions(+), 54 deletions(-)
create mode 100644 sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultPreBackupOperation.cs
create mode 100644 sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultPreRestoreOperation.cs
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupClient.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupClient.cs
index e9131ec343fe6..9c3ea0d922c13 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupClient.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupClient.cs
@@ -131,8 +131,8 @@ public virtual KeyVaultBackupOperation StartBackup(Uri blobStorageUri, string sa
/// A controlling the request lifetime.
/// or is null.
/// The server returned an error. See for details returned from the server.
- /// A representing the result of the asynchronous operation.
- public virtual async Task StartPreBackupAsync(Uri blobStorageUri, string sasToken = default, CancellationToken cancellationToken = default)
+ /// A representing the result of the asynchronous operation.
+ public virtual async Task StartPreBackupAsync(Uri blobStorageUri, string sasToken = default, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(blobStorageUri, nameof(blobStorageUri));
Argument.AssertNotNull(sasToken, nameof(sasToken));
@@ -151,7 +151,7 @@ public virtual async Task StartPreBackupAsync(Uri blobS
cancellationToken).ConfigureAwait(false);
// Should this return a KeyVaultBackupOperation?
- return new KeyVaultBackupOperation(this, response);
+ return new KeyVaultPreBackupOperation(this, response);
}
catch (Exception ex)
{
@@ -168,8 +168,8 @@ public virtual async Task StartPreBackupAsync(Uri blobS
/// A controlling the request lifetime.
/// or is null.
/// The server returned an error. See for details returned from the server.
- /// A representing the result of the operation.
- public virtual KeyVaultBackupOperation StartPreBackup(Uri blobStorageUri, string sasToken = default, CancellationToken cancellationToken = default)
+ /// A representing the result of the operation.
+ public virtual KeyVaultPreBackupOperation StartPreBackup(Uri blobStorageUri, string sasToken = default, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(blobStorageUri, nameof(blobStorageUri));
Argument.AssertNotNull(sasToken, nameof(sasToken));
@@ -188,7 +188,7 @@ public virtual KeyVaultBackupOperation StartPreBackup(Uri blobStorageUri, string
cancellationToken);
// Should this return a KeyVaultBackupOperation?
- return new KeyVaultBackupOperation(this, response);
+ return new KeyVaultPreBackupOperation(this, response);
}
catch (Exception ex)
{
@@ -249,8 +249,8 @@ public virtual async Task StartRestoreAsync(Uri folder
/// A controlling the request lifetime.
/// or is null.
/// The server returned an error. See for details returned from the server.
- /// A representing the result of the asynchronous operation.
- public virtual async Task StartPreRestoreAsync(Uri folderUri, string sasToken = default, CancellationToken cancellationToken = default)
+ /// A representing the result of the asynchronous operation.
+ public virtual async Task StartPreRestoreAsync(Uri folderUri, string sasToken = default, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(folderUri, nameof(folderUri));
Argument.AssertNotNull(sasToken, nameof(sasToken));
@@ -270,7 +270,7 @@ public virtual async Task StartPreRestoreAsync(Uri fol
),
cancellationToken).ConfigureAwait(false);
- return new KeyVaultRestoreOperation(this, response);
+ return new KeyVaultPreRestoreOperation(this, response);
}
catch (Exception ex)
{
@@ -291,8 +291,8 @@ public virtual async Task StartPreRestoreAsync(Uri fol
/// A controlling the request lifetime.
/// or is null.
/// The server returned an error. See for details returned from the server.
- /// A representing the result of the asynchronous operation.
- public virtual KeyVaultRestoreOperation StartPreRestore(Uri folderUri, string sasToken = default, CancellationToken cancellationToken = default)
+ /// A to wait on this long-running operation.
+ public virtual KeyVaultPreRestoreOperation StartPreRestore(Uri folderUri, string sasToken = default, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(folderUri, nameof(folderUri));
Argument.AssertNotNull(sasToken, nameof(sasToken));
@@ -311,7 +311,7 @@ public virtual KeyVaultRestoreOperation StartPreRestore(Uri folderUri, string sa
folderUri.AbsoluteUri
),
cancellationToken);
- return new KeyVaultRestoreOperation(this, response);
+ return new KeyVaultPreRestoreOperation(this, response);
}
catch (Exception ex)
{
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupOperation.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupOperation.cs
index 9010d71e1ca89..a2cd70bbc61d1 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupOperation.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultBackupOperation.cs
@@ -55,19 +55,6 @@ internal KeyVaultBackupOperation(KeyVaultBackupClient client, ResponseWithHeader
_id = response.Headers.JobId() ?? throw new InvalidOperationException("The response does not contain an Id");
}
- ///
- /// Initializes a new instance of a KeyVaultBackupOperation.
- ///
- /// An instance of .
- /// The returned from or .
- ///
- internal KeyVaultBackupOperation(KeyVaultBackupClient client, ResponseWithHeaders response){
- _client = client;
- _response = response;
- _retryAfterSeconds = (int)response.Headers.RetryAfter;
- _id = response.Headers.JobId() ?? throw new InvalidOperationException("The response does not contain an Id");
- }
-
///
/// Initializes a new instance of a KeyVaultBackupOperation for mocking purposes.
///
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultPreBackupOperation.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultPreBackupOperation.cs
new file mode 100644
index 0000000000000..96108bd4e052a
--- /dev/null
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultPreBackupOperation.cs
@@ -0,0 +1,177 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using System;
+using Azure.Core;
+using Azure.Security.KeyVault.Administration.Models;
+using System.Threading.Tasks;
+using System.Threading;
+using Azure.Core.Pipeline;
+
+namespace Azure.Security.KeyVault.Administration
+{
+ ///
+ /// A long-running operation for or .
+ ///
+ public class KeyVaultPreBackupOperation : Operation
+ {
+ ///
+ /// The number of seconds recommended by the service to delay before checking on completion status.
+ ///
+ internal long? _retryAfterSeconds;
+ private readonly KeyVaultBackupClient _client;
+ private Response _response;
+ private FullBackupDetailsInternal _value;
+ private readonly string _id;
+ private RequestFailedException _requestFailedException;
+
+ ///
+ /// Creates an instance of a KeyVaultPreBackupOperation from a previously started operation. , ,
+ /// , or must be called
+ /// to re-populate the details of this operation.
+ ///
+ /// An instance of .
+ /// The from a previous .
+ /// or is null.
+ public KeyVaultPreBackupOperation(KeyVaultBackupClient client, string id)
+ {
+ Argument.AssertNotNull(id, nameof(id));
+ Argument.AssertNotNull(client, nameof(client));
+
+ _client = client;
+ _id = id;
+ }
+
+ ///
+ /// Initializes a new instance of a KeyVaultPreBackupOperation.
+ ///
+ /// An instance of .
+ /// The returned from or .
+ /// The server operation does not contains an Id
+ internal KeyVaultPreBackupOperation(KeyVaultBackupClient client, ResponseWithHeaders response)
+ {
+ _client = client;
+ _response = response;
+ _retryAfterSeconds = response.Headers.RetryAfter;
+ _id = response.Headers.JobId() ?? throw new InvalidOperationException("The response does not contain an Id");
+ }
+
+ ///
+ /// Initializes a new instance of a KeyVaultPreBackupOperation for mocking purposes.
+ ///
+ /// The that will be returned from .
+ /// The that will be returned from .
+ /// An instance of .
+ internal KeyVaultPreBackupOperation(FullBackupDetailsInternal value, Response response, KeyVaultBackupClient client)
+ {
+ Argument.AssertNotNull(value, nameof(value));
+ Argument.AssertNotNull(response, nameof(response));
+ Argument.AssertNotNull(client, nameof(client));
+
+ _response = response;
+ _value = value;
+ _id = value.JobId;
+ _client = client;
+ }
+
+ /// Initializes a new instance of for mocking.
+ protected KeyVaultPreBackupOperation() { }
+
+ ///
+ /// The start time of the backup operation.
+ ///
+ public DateTimeOffset? StartTime => _value?.StartTime;
+
+ ///
+ /// The end time of the backup operation.
+ ///
+ public DateTimeOffset? EndTime => _value?.EndTime;
+
+ ///
+ public override string Id => _id;
+
+ ///
+ /// Gets the of the backup operation.
+ /// You should await before attempting to use a key in this pending state.
+ ///
+ public override KeyVaultBackupResult Value
+ {
+ get
+ {
+#pragma warning disable CA1065 // Do not raise exceptions in unexpected locations
+ if (!HasCompleted)
+ {
+ throw new InvalidOperationException("The operation is not complete.");
+ }
+ if (_requestFailedException != null)
+ {
+ throw _requestFailedException;
+ }
+#pragma warning restore CA1065 // Do not raise exceptions in unexpected locations
+ return new KeyVaultBackupResult(new Uri(_value.AzureStorageBlobContainerUri), _value.StartTime.Value, _value.EndTime.Value);
+ }
+ }
+
+ ///
+ public override bool HasCompleted => _value?.EndTime.HasValue ?? false;
+
+ ///
+ public override bool HasValue => _response != null && _value?.Error == null && HasCompleted;
+
+ ///
+ public override Response GetRawResponse() => _response;
+
+ ///
+ public override Response UpdateStatus(CancellationToken cancellationToken = default) =>
+ UpdateStatusAsync(false, cancellationToken).EnsureCompleted();
+
+ ///
+ public override async ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) =>
+ await UpdateStatusAsync(true, cancellationToken).ConfigureAwait(false);
+
+ private async ValueTask UpdateStatusAsync(bool async, CancellationToken cancellationToken = default)
+ {
+ if (!HasCompleted)
+ {
+ try
+ {
+ Response response = async ?
+ await _client.GetBackupDetailsAsync(Id, cancellationToken).ConfigureAwait(false)
+ : _client.GetBackupDetails(Id, cancellationToken);
+
+ _value = response.Value;
+ _response = response.GetRawResponse();
+ }
+ catch (RequestFailedException ex)
+ {
+ _requestFailedException = ex;
+ throw;
+ }
+ catch (Exception ex)
+ {
+ _requestFailedException = new RequestFailedException("Unexpected failure", ex);
+ throw _requestFailedException;
+ }
+
+ if (_value != null && _value.EndTime.HasValue && _value.Error != null)
+ {
+ _requestFailedException = _response != null ?
+ new RequestFailedException(_response)
+ : new RequestFailedException($"{_value.Error.Message}\nInnerError: {_value.Error.InnerError}\nCode: {_value.Error.Code}");
+ throw _requestFailedException;
+ }
+ }
+
+ return GetRawResponse();
+ }
+
+ ///
+ public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) =>
+ _retryAfterSeconds.HasValue ? this.DefaultWaitForCompletionAsync(TimeSpan.FromSeconds(_retryAfterSeconds.Value), cancellationToken) :
+ this.DefaultWaitForCompletionAsync(cancellationToken);
+
+ ///
+ public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken) =>
+ this.DefaultWaitForCompletionAsync(pollingInterval, cancellationToken);
+ }
+}
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultPreRestoreOperation.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultPreRestoreOperation.cs
new file mode 100644
index 0000000000000..458a084ecc0af
--- /dev/null
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultPreRestoreOperation.cs
@@ -0,0 +1,95 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure.Core;
+using Azure.Security.KeyVault.Administration.Models;
+
+namespace Azure.Security.KeyVault.Administration
+{
+ ///
+ /// A long-running operation for or .
+ ///
+ public class KeyVaultPreRestoreOperation : Operation
+ {
+ internal readonly RestoreOperationInternal _operationInternal;
+
+ ///
+ /// Creates an instance of a KeyVaultPreRestoreOperation from a previously started operation. , ,
+ /// , or must be called
+ /// to re-populate the details of this operation.
+ ///
+ /// An instance of .
+ /// The from a previous .
+ /// or is null.
+ public KeyVaultPreRestoreOperation(KeyVaultBackupClient client, string id)
+ {
+ _operationInternal = new RestoreOperationInternal(client, id);
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// An instance of .
+ /// The returned from or .
+ internal KeyVaultPreRestoreOperation(KeyVaultBackupClient client, ResponseWithHeaders response)
+ {
+ _operationInternal = new RestoreOperationInternal(client, response);
+ }
+
+ ///
+ /// Initializes a new instance of a KeyVaultPreRestoreOperation for mocking purposes.
+ ///
+ /// The that will be used to populate various properties.
+ /// The that will be returned from .
+ /// An instance of .
+ /// or or is null.
+ internal KeyVaultPreRestoreOperation(RestoreDetailsInternal value, Response response, KeyVaultBackupClient client)
+ {
+ _operationInternal = new RestoreOperationInternal(value, response, client);
+ }
+
+ /// Initializes a new instance of for mocking.
+ protected KeyVaultPreRestoreOperation() {}
+
+ ///
+ /// The start time of the restore operation.
+ ///
+ public DateTimeOffset? StartTime => _operationInternal.StartTime;
+
+ ///
+ /// The end time of the restore operation.
+ ///
+ public DateTimeOffset? EndTime => _operationInternal.EndTime;
+
+ ///
+ public override string Id => _operationInternal.Id;
+ ///
+ public override KeyVaultRestoreResult Value => _operationInternal.Value;
+
+ ///
+ public override bool HasCompleted => _operationInternal.HasCompleted;
+
+ ///
+ public override bool HasValue => _operationInternal.HasValue;
+
+ ///
+ public override Response GetRawResponse() => _operationInternal.GetRawResponse();
+
+ ///
+ public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operationInternal.UpdateStatus(cancellationToken);
+
+ ///
+ public override async ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => await _operationInternal.UpdateStatusAsync(cancellationToken).ConfigureAwait(false);
+
+ ///
+ public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) =>
+ _operationInternal.WaitForCompletionAsync(cancellationToken);
+
+ ///
+ public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken) =>
+ _operationInternal.WaitForCompletionAsync(pollingInterval, cancellationToken);
+ }
+}
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultRestoreOperation.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultRestoreOperation.cs
index 0106c40191e42..a57b24f9747a5 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultRestoreOperation.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultRestoreOperation.cs
@@ -15,9 +15,6 @@ namespace Azure.Security.KeyVault.Administration
public class KeyVaultRestoreOperation : Operation
{
internal readonly RestoreOperationInternal _operationInternal;
- internal readonly RestoreOperationInternal _preOperationInternal;
-
- private bool _isPreOperation = false;
///
/// Creates an instance of a KeyVaultRestoreOperation from a previously started operation. , ,
@@ -43,17 +40,6 @@ internal KeyVaultRestoreOperation(KeyVaultBackupClient client, ResponseWithHeade
_operationInternal = new RestoreOperationInternal(client, response);
}
- ///
- /// Initializes a new instance of the class.
- ///
- /// An instance of .
- /// The returned from or .
- internal KeyVaultRestoreOperation(KeyVaultBackupClient client, ResponseWithHeaders response)
- {
- _isPreOperation = true;
- _preOperationInternal = new RestoreOperationInternal(client, response);
- }
-
///
/// Initializes a new instance of a KeyVaultRestoreOperation for mocking purposes.
///
@@ -72,39 +58,39 @@ protected KeyVaultRestoreOperation() {}
///
/// The start time of the restore operation.
///
- public DateTimeOffset? StartTime => _isPreOperation? _preOperationInternal.StartTime : _operationInternal.StartTime;
+ public DateTimeOffset? StartTime => _operationInternal.StartTime;
///
/// The end time of the restore operation.
///
- public DateTimeOffset? EndTime => _isPreOperation? _preOperationInternal.EndTime : _operationInternal.EndTime;
+ public DateTimeOffset? EndTime => _operationInternal.EndTime;
///
- public override string Id => _isPreOperation? _preOperationInternal.Id : _operationInternal.Id;
+ public override string Id => _operationInternal.Id;
///
- public override KeyVaultRestoreResult Value => _isPreOperation? _preOperationInternal.Value : _operationInternal.Value;
+ public override KeyVaultRestoreResult Value => _operationInternal.Value;
///
- public override bool HasCompleted => _isPreOperation? _preOperationInternal.HasCompleted: _operationInternal.HasCompleted;
+ public override bool HasCompleted => _operationInternal.HasCompleted;
///
- public override bool HasValue => _isPreOperation? _preOperationInternal.HasValue: _operationInternal.HasValue;
+ public override bool HasValue => _operationInternal.HasValue;
///
- public override Response GetRawResponse() => _isPreOperation? _preOperationInternal.GetRawResponse(): _operationInternal.GetRawResponse();
+ public override Response GetRawResponse() => _operationInternal.GetRawResponse();
///
- public override Response UpdateStatus(CancellationToken cancellationToken = default) => _isPreOperation? _preOperationInternal.UpdateStatus(cancellationToken): _operationInternal.UpdateStatus(cancellationToken);
+ public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operationInternal.UpdateStatus(cancellationToken);
///
- public override async ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _isPreOperation? await _preOperationInternal.UpdateStatusAsync(cancellationToken).ConfigureAwait(false): await _operationInternal.UpdateStatusAsync(cancellationToken).ConfigureAwait(false);
+ public override async ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => await _operationInternal.UpdateStatusAsync(cancellationToken).ConfigureAwait(false);
///
public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) =>
- _isPreOperation? _preOperationInternal.WaitForCompletionAsync(cancellationToken): _operationInternal.WaitForCompletionAsync(cancellationToken);
+ _operationInternal.WaitForCompletionAsync(cancellationToken);
///
public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken) =>
- _isPreOperation? _preOperationInternal.WaitForCompletionAsync(pollingInterval, cancellationToken): _operationInternal.WaitForCompletionAsync(pollingInterval, cancellationToken);
+ _operationInternal.WaitForCompletionAsync(pollingInterval, cancellationToken);
}
}
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/FullBackupClientLiveTests.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/FullBackupClientLiveTests.cs
index dffb519dddd5e..843e1fe3a9d04 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/FullBackupClientLiveTests.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/FullBackupClientLiveTests.cs
@@ -59,7 +59,7 @@ public async Task PreBackupAndPreRestore()
builder.Path = BlobContainerName;
// Start the pre-backup operation.
- KeyVaultBackupOperation preBackupOperation = await Client.StartPreBackupAsync(builder.Uri, "?" + SasToken, source.Token);
+ KeyVaultPreBackupOperation preBackupOperation = await Client.StartPreBackupAsync(builder.Uri, "?" + SasToken, source.Token);
KeyVaultBackupResult preBackupResult = await preBackupOperation.WaitForCompletionAsync(source.Token);
@@ -70,7 +70,7 @@ public async Task PreBackupAndPreRestore()
Assert.That(preBackupOperation.HasValue, Is.True);
// Start the pre-restore operation.
- KeyVaultRestoreOperation preRestoreOperation = await Client.StartPreRestoreAsync(preBackupResult.FolderUri, "?" + SasToken, source.Token);
+ KeyVaultPreRestoreOperation preRestoreOperation = await Client.StartPreRestoreAsync(preBackupResult.FolderUri, "?" + SasToken, source.Token);
KeyVaultRestoreResult preRestoreResult = await preRestoreOperation.WaitForCompletionAsync(source.Token);
await WaitForOperationAsync();
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/samples/Sample1_BackupHelloWorld.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/samples/Sample1_BackupHelloWorld.cs
index e17c440396f86..103dae4df1e79 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/samples/Sample1_BackupHelloWorld.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/samples/Sample1_BackupHelloWorld.cs
@@ -87,7 +87,7 @@ public async Task PreBackupAndPreRestoreSampleAsync()
};
// Check for backup readiness.
- KeyVaultBackupOperation backupOperation = await Client.StartPreBackupAsync(builder.Uri, sasToken);
+ KeyVaultPreBackupOperation backupOperation = await Client.StartPreBackupAsync(builder.Uri, sasToken);
// Wait for completion of the PreBackupOperation.
Response backupResult = await backupOperation.WaitForCompletionAsync();
@@ -108,7 +108,7 @@ public async Task PreBackupAndPreRestoreSampleAsync()
#region Snippet:HelloPreFullRestoreAsync
// Check for restore readiness using the backupBlobUri returned from a previous BackupOperation.
- KeyVaultRestoreOperation preRestoreOperation = await Client.StartPreRestoreAsync(folderUri, sasToken);
+ KeyVaultPreRestoreOperation preRestoreOperation = await Client.StartPreRestoreAsync(folderUri, sasToken);
// Wait for completion of the PreRestoreOperation.
Response preRestoreResult = await preRestoreOperation.WaitForCompletionAsync();
From e8f604d3211769e985948aed6517a9e5f9e26259 Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Fri, 16 Aug 2024 14:58:05 -0700
Subject: [PATCH 29/37] Ignore tests for preview version
---
.../tests/FullBackupClientLiveTests.cs | 1 +
.../tests/samples/Sample1_BackupHelloWorld.cs | 1 +
2 files changed, 2 insertions(+)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/FullBackupClientLiveTests.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/FullBackupClientLiveTests.cs
index 843e1fe3a9d04..bc4e404c519cc 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/FullBackupClientLiveTests.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/FullBackupClientLiveTests.cs
@@ -51,6 +51,7 @@ public async Task BackupAndRestore()
}
[RecordedTest]
+ [Ignore("Service preview is not available yet.")]
public async Task PreBackupAndPreRestore()
{
var source = new CancellationTokenSource(Timeout);
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/samples/Sample1_BackupHelloWorld.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/samples/Sample1_BackupHelloWorld.cs
index 103dae4df1e79..3666845c56bf5 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/samples/Sample1_BackupHelloWorld.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/samples/Sample1_BackupHelloWorld.cs
@@ -73,6 +73,7 @@ public async Task BackupAndRestoreSampleAsync()
[RecordedTest]
[AsyncOnly]
+ [Ignore("Service preview is not available yet")]
public async Task PreBackupAndPreRestoreSampleAsync()
{
var blobStorageUrl = TestEnvironment.StorageUri;
From 05bdca8da9f0394e49291eaf517de5702056c5fd Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Fri, 16 Aug 2024 15:10:08 -0700
Subject: [PATCH 30/37] Revert changes in KeyVaultRestoreOperation
---
.../src/KeyVaultRestoreOperation.cs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultRestoreOperation.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultRestoreOperation.cs
index a57b24f9747a5..d862a119c32e0 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultRestoreOperation.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultRestoreOperation.cs
@@ -67,6 +67,7 @@ protected KeyVaultRestoreOperation() {}
///
public override string Id => _operationInternal.Id;
+
///
public override KeyVaultRestoreResult Value => _operationInternal.Value;
@@ -83,7 +84,8 @@ protected KeyVaultRestoreOperation() {}
public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operationInternal.UpdateStatus(cancellationToken);
///
- public override async ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => await _operationInternal.UpdateStatusAsync(cancellationToken).ConfigureAwait(false);
+ public override async ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) =>
+ await _operationInternal.UpdateStatusAsync(cancellationToken).ConfigureAwait(false);
///
public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) =>
From d9e55b3c157e03add0744f1396534cee3037f144 Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Mon, 19 Aug 2024 14:35:39 -0700
Subject: [PATCH 31/37] Include possible exceptions to pre-operation classes
---
.../src/KeyVaultPreBackupOperation.cs | 4 +++-
.../src/KeyVaultPreRestoreOperation.cs | 12 ++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultPreBackupOperation.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultPreBackupOperation.cs
index 96108bd4e052a..92ed12ee8f5ae 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultPreBackupOperation.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultPreBackupOperation.cs
@@ -33,9 +33,10 @@ public class KeyVaultPreBackupOperation : Operation
/// An instance of .
/// The from a previous .
/// or is null.
+ /// is empty.
public KeyVaultPreBackupOperation(KeyVaultBackupClient client, string id)
{
- Argument.AssertNotNull(id, nameof(id));
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
Argument.AssertNotNull(client, nameof(client));
_client = client;
@@ -62,6 +63,7 @@ internal KeyVaultPreBackupOperation(KeyVaultBackupClient client, ResponseWithHea
/// The that will be returned from .
/// The that will be returned from .
/// An instance of .
+ /// , , or is null.
internal KeyVaultPreBackupOperation(FullBackupDetailsInternal value, Response response, KeyVaultBackupClient client)
{
Argument.AssertNotNull(value, nameof(value));
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultPreRestoreOperation.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultPreRestoreOperation.cs
index 458a084ecc0af..f0e236b47af77 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultPreRestoreOperation.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/src/KeyVaultPreRestoreOperation.cs
@@ -24,8 +24,12 @@ public class KeyVaultPreRestoreOperation : Operation
/// An instance of .
/// The from a previous .
/// or is null.
+ /// is empty.
public KeyVaultPreRestoreOperation(KeyVaultBackupClient client, string id)
{
+ Argument.AssertNotNull(client, nameof(client));
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
+
_operationInternal = new RestoreOperationInternal(client, id);
}
@@ -34,8 +38,12 @@ public KeyVaultPreRestoreOperation(KeyVaultBackupClient client, string id)
///
/// An instance of .
/// The returned from or .
+ /// or is null.
internal KeyVaultPreRestoreOperation(KeyVaultBackupClient client, ResponseWithHeaders response)
{
+ Argument.AssertNotNull(client, nameof(client));
+ Argument.AssertNotNull(response, nameof(response));
+
_operationInternal = new RestoreOperationInternal(client, response);
}
@@ -48,6 +56,10 @@ internal KeyVaultPreRestoreOperation(KeyVaultBackupClient client, ResponseWithHe
/// or or is null.
internal KeyVaultPreRestoreOperation(RestoreDetailsInternal value, Response response, KeyVaultBackupClient client)
{
+ Argument.AssertNotNull(value, nameof(value));
+ Argument.AssertNotNull(response, nameof(response));
+ Argument.AssertNotNull(client, nameof(client));
+
_operationInternal = new RestoreOperationInternal(value, response, client);
}
From 986dc33aeb115efee883adf114f8e9bed4ce4fc6 Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Tue, 20 Aug 2024 14:10:56 -0700
Subject: [PATCH 32/37] Record Secrets
---
sdk/keyvault/Azure.Security.KeyVault.Secrets/assets.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Secrets/assets.json b/sdk/keyvault/Azure.Security.KeyVault.Secrets/assets.json
index 73d76b643745d..e0ec389740ee9 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Secrets/assets.json
+++ b/sdk/keyvault/Azure.Security.KeyVault.Secrets/assets.json
@@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "net",
"TagPrefix": "net/keyvault/Azure.Security.KeyVault.Secrets",
- "Tag": "net/keyvault/Azure.Security.KeyVault.Secrets_18b0beab8a"
+ "Tag": "net/keyvault/Azure.Security.KeyVault.Secrets_033d39a9d2"
}
From 257e7993c8c014c683e9d9da9da1a22893b7231f Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Wed, 21 Aug 2024 10:29:13 -0700
Subject: [PATCH 33/37] Record Keys tests
---
sdk/keyvault/Azure.Security.KeyVault.Keys/assets.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Keys/assets.json b/sdk/keyvault/Azure.Security.KeyVault.Keys/assets.json
index 59c5d87f82ee4..23e1dd31e6317 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Keys/assets.json
+++ b/sdk/keyvault/Azure.Security.KeyVault.Keys/assets.json
@@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "net",
"TagPrefix": "net/keyvault/Azure.Security.KeyVault.Keys",
- "Tag": "net/keyvault/Azure.Security.KeyVault.Keys_a8557a0a67"
+ "Tag": "net/keyvault/Azure.Security.KeyVault.Keys_5dc33e5113"
}
From 7cd69560bd8dcc30f576a38b0f3997751e199444 Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Wed, 21 Aug 2024 20:04:36 -0700
Subject: [PATCH 34/37] Record admin
---
sdk/keyvault/Azure.Security.KeyVault.Administration/assets.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/assets.json b/sdk/keyvault/Azure.Security.KeyVault.Administration/assets.json
index 3072779aaa8ae..28336ec072ed2 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/assets.json
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/assets.json
@@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "net",
"TagPrefix": "net/keyvault/Azure.Security.KeyVault.Administration",
- "Tag": "net/keyvault/Azure.Security.KeyVault.Administration_4951f6b8e1"
+ "Tag": "net/keyvault/Azure.Security.KeyVault.Administration_2b51d5440c"
}
From ae74942d5f636abb1f99d319a03b6343edff8891 Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Mon, 26 Aug 2024 15:00:12 -0700
Subject: [PATCH 35/37] Re-record failing tests for Secrets
---
sdk/keyvault/Azure.Security.KeyVault.Secrets/assets.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Secrets/assets.json b/sdk/keyvault/Azure.Security.KeyVault.Secrets/assets.json
index e0ec389740ee9..2f5fc05d04bfe 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Secrets/assets.json
+++ b/sdk/keyvault/Azure.Security.KeyVault.Secrets/assets.json
@@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "net",
"TagPrefix": "net/keyvault/Azure.Security.KeyVault.Secrets",
- "Tag": "net/keyvault/Azure.Security.KeyVault.Secrets_033d39a9d2"
+ "Tag": "net/keyvault/Azure.Security.KeyVault.Secrets_835634e403"
}
From 2c483e0d264c22c678fe39ca6b6f8b4af24ac2d5 Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Mon, 26 Aug 2024 15:00:35 -0700
Subject: [PATCH 36/37] Update test-resources json to output the Tenant ID too
---
sdk/keyvault/test-resources.json | 74 +++++++++++++++++---------------
1 file changed, 39 insertions(+), 35 deletions(-)
diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json
index 6f70888a84511..f8d5d93e57113 100644
--- a/sdk/keyvault/test-resources.json
+++ b/sdk/keyvault/test-resources.json
@@ -283,40 +283,44 @@
}
}
],
- "outputs": {
- "AZURE_KEYVAULT_URL": {
- "type": "string",
- "value": "[reference(variables('kvName')).vaultUri]"
- },
- "AZURE_MANAGEDHSM_URL": {
- "type": "string",
- "condition": "[parameters('enableHsm')]",
- "value": "[reference(variables('hsmName')).hsmUri]"
- },
- "KEYVAULT_SKU": {
- "type": "string",
- "value": "[reference(parameters('baseName')).sku.name]"
- },
- "CLIENT_OBJECTID": {
- "type": "string",
- "value": "[parameters('testApplicationOid')]"
- },
- "BLOB_STORAGE_ACCOUNT_NAME": {
- "type": "string",
- "value": "[variables('primaryAccountName')]"
- },
- "BLOB_PRIMARY_STORAGE_ACCOUNT_KEY": {
- "type": "string",
- "value": "[listKeys(variables('primaryAccountName'), variables('mgmtApiVersion')).keys[0].value]"
- },
- "BLOB_CONTAINER_NAME" : {
- "type": "string",
- "value": "[variables('blobContainerName')]"
- },
- "AZURE_KEYVAULT_ATTESTATION_URL": {
- "type": "string",
- "condition": "[parameters('enableAttestation')]",
- "value": "[format('https://{0}/', reference(variables('attestationSite')).defaultHostName)]"
- }
+ "outputs": {
+ "AZURE_KEYVAULT_URL": {
+ "type": "string",
+ "value": "[reference(variables('kvName')).vaultUri]"
+ },
+ "AZURE_MANAGEDHSM_URL": {
+ "type": "string",
+ "condition": "[parameters('enableHsm')]",
+ "value": "[reference(variables('hsmName')).hsmUri]"
+ },
+ "KEYVAULT_SKU": {
+ "type": "string",
+ "value": "[reference(parameters('baseName')).sku.name]"
+ },
+ "CLIENT_OBJECTID": {
+ "type": "string",
+ "value": "[parameters('testApplicationOid')]"
+ },
+ "BLOB_STORAGE_ACCOUNT_NAME": {
+ "type": "string",
+ "value": "[variables('primaryAccountName')]"
+ },
+ "BLOB_PRIMARY_STORAGE_ACCOUNT_KEY": {
+ "type": "string",
+ "value": "[listKeys(variables('primaryAccountName'), variables('mgmtApiVersion')).keys[0].value]"
+ },
+ "BLOB_CONTAINER_NAME": {
+ "type": "string",
+ "value": "[variables('blobContainerName')]"
+ },
+ "AZURE_KEYVAULT_ATTESTATION_URL": {
+ "type": "string",
+ "condition": "[parameters('enableAttestation')]",
+ "value": "[format('https://{0}/', reference(variables('attestationSite')).defaultHostName)]"
+ },
+ "KEYVAULT_TENANT_ID": {
+ "type": "string",
+ "value": "[parameters('tenantId')]"
}
+ }
}
From 81114fb80504401d772a73d89fc12d8c00ef56f1 Mon Sep 17 00:00:00 2001
From: Jonathan Cardenas
Date: Mon, 26 Aug 2024 16:01:30 -0700
Subject: [PATCH 37/37] Export API and remove unused snippets
---
....KeyVault.Administration.netstandard2.0.cs | 40 +++++++++++++++++--
.../tests/samples/Sample1_BackupHelloWorld.cs | 4 --
2 files changed, 36 insertions(+), 8 deletions(-)
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/api/Azure.Security.KeyVault.Administration.netstandard2.0.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/api/Azure.Security.KeyVault.Administration.netstandard2.0.cs
index 951cfd7661d16..0c1a09a9ad6f5 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/api/Azure.Security.KeyVault.Administration.netstandard2.0.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/api/Azure.Security.KeyVault.Administration.netstandard2.0.cs
@@ -80,10 +80,10 @@ public KeyVaultBackupClient(System.Uri vaultUri, Azure.Core.TokenCredential cred
public virtual System.Uri VaultUri { get { throw null; } }
public virtual Azure.Security.KeyVault.Administration.KeyVaultBackupOperation StartBackup(System.Uri blobStorageUri, string sasToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task StartBackupAsync(System.Uri blobStorageUri, string sasToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
- public virtual Azure.Security.KeyVault.Administration.KeyVaultBackupOperation StartPreBackup(System.Uri blobStorageUri, string sasToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
- public virtual System.Threading.Tasks.Task StartPreBackupAsync(System.Uri blobStorageUri, string sasToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
- public virtual Azure.Security.KeyVault.Administration.KeyVaultRestoreOperation StartPreRestore(System.Uri folderUri, string sasToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
- public virtual System.Threading.Tasks.Task StartPreRestoreAsync(System.Uri folderUri, string sasToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Security.KeyVault.Administration.KeyVaultPreBackupOperation StartPreBackup(System.Uri blobStorageUri, string sasToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual System.Threading.Tasks.Task StartPreBackupAsync(System.Uri blobStorageUri, string sasToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Security.KeyVault.Administration.KeyVaultPreRestoreOperation StartPreRestore(System.Uri folderUri, string sasToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual System.Threading.Tasks.Task StartPreRestoreAsync(System.Uri folderUri, string sasToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Security.KeyVault.Administration.KeyVaultRestoreOperation StartRestore(System.Uri folderUri, string sasToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task StartRestoreAsync(System.Uri folderUri, string sasToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Security.KeyVault.Administration.KeyVaultSelectiveKeyRestoreOperation StartSelectiveKeyRestore(string keyName, System.Uri folderUri, string sasToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
@@ -170,6 +170,38 @@ public KeyVaultPermission() { }
public System.Collections.Generic.IList NotActions { get { throw null; } }
public System.Collections.Generic.IList NotDataActions { get { throw null; } }
}
+ public partial class KeyVaultPreBackupOperation : Azure.Operation
+ {
+ protected KeyVaultPreBackupOperation() { }
+ public KeyVaultPreBackupOperation(Azure.Security.KeyVault.Administration.KeyVaultBackupClient client, string id) { }
+ public System.DateTimeOffset? EndTime { get { throw null; } }
+ public override bool HasCompleted { get { throw null; } }
+ public override bool HasValue { get { throw null; } }
+ public override string Id { get { throw null; } }
+ public System.DateTimeOffset? StartTime { get { throw null; } }
+ public override Azure.Security.KeyVault.Administration.KeyVaultBackupResult Value { get { throw null; } }
+ public override Azure.Response GetRawResponse() { throw null; }
+ public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken) { throw null; }
+ }
+ public partial class KeyVaultPreRestoreOperation : Azure.Operation
+ {
+ protected KeyVaultPreRestoreOperation() { }
+ public KeyVaultPreRestoreOperation(Azure.Security.KeyVault.Administration.KeyVaultBackupClient client, string id) { }
+ public System.DateTimeOffset? EndTime { get { throw null; } }
+ public override bool HasCompleted { get { throw null; } }
+ public override bool HasValue { get { throw null; } }
+ public override string Id { get { throw null; } }
+ public System.DateTimeOffset? StartTime { get { throw null; } }
+ public override Azure.Security.KeyVault.Administration.KeyVaultRestoreResult Value { get { throw null; } }
+ public override Azure.Response GetRawResponse() { throw null; }
+ public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken) { throw null; }
+ }
public partial class KeyVaultRestoreOperation : Azure.Operation
{
protected KeyVaultRestoreOperation() { }
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/samples/Sample1_BackupHelloWorld.cs b/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/samples/Sample1_BackupHelloWorld.cs
index 3666845c56bf5..b070f3048b934 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/samples/Sample1_BackupHelloWorld.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/samples/Sample1_BackupHelloWorld.cs
@@ -80,7 +80,6 @@ public async Task PreBackupAndPreRestoreSampleAsync()
var blobContainerName = BlobContainerName;
var sasToken = "?" + SasToken;
- #region Snippet:HelloPreFullBackupAsync
// Create a Uri with the storage container
UriBuilder builder = new UriBuilder(blobStorageUrl)
{
@@ -100,14 +99,12 @@ public async Task PreBackupAndPreRestoreSampleAsync()
{
Console.WriteLine($"Backup operation failed. Status: {backupOperation.GetRawResponse().Status}, Reason: {backupOperation.GetRawResponse().ReasonPhrase}");
}
- #endregion
Assert.That(folderUri, Is.Not.Null);
Assert.That(backupOperation.HasValue, Is.True);
await WaitForOperationAsync();
- #region Snippet:HelloPreFullRestoreAsync
// Check for restore readiness using the backupBlobUri returned from a previous BackupOperation.
KeyVaultPreRestoreOperation preRestoreOperation = await Client.StartPreRestoreAsync(folderUri, sasToken);
@@ -123,7 +120,6 @@ public async Task PreBackupAndPreRestoreSampleAsync()
{
Console.WriteLine($"Pre-restore operation failed. Status: {preRestoreOperation.GetRawResponse().Status}, Reason: {preRestoreOperation.GetRawResponse().ReasonPhrase}");
}
- #endregion
Assert.That(preRestoreOperation.HasValue, Is.True);
Assert.That(preRestoreResult.Value.StartTime, Is.Not.EqualTo(default));