diff --git a/.vscode/cspell.json b/.vscode/cspell.json index 56b8969ffc171..a5a65404f865d 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -35,6 +35,7 @@ "azsdk", "blazor", "contoso", + "deserializable", "deserializes", "diagnoser", "dtmf", diff --git a/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/Azure.Security.KeyVault.Certificates.csproj b/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/Azure.Security.KeyVault.Certificates.csproj index 9fc9dd25d3e3f..8c50199d30faf 100644 --- a/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/Azure.Security.KeyVault.Certificates.csproj +++ b/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/Azure.Security.KeyVault.Certificates.csproj @@ -10,7 +10,6 @@ $(RequiredTargetFrameworks) $(NoWarn);3021 true - false $(NoWarn);1591 diff --git a/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/CertificateOperation.cs b/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/CertificateOperation.cs index 2b7767f39efc7..c271bf3f1fb09 100644 --- a/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/CertificateOperation.cs +++ b/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/CertificateOperation.cs @@ -35,7 +35,7 @@ public CertificateOperation(CertificateClient client, string name) Properties = new CertificateOperationProperties(client.VaultUri, name); - Id = Properties.Id.ToString(); + Id = Properties.Id.AbsoluteUri; _client = client; } @@ -43,7 +43,7 @@ internal CertificateOperation(Response propertie { Properties = properties; - Id = Properties.Id.ToString(); + Id = Properties.Id.AbsoluteUri; _client = client; } diff --git a/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/CertificatesEventSource.cs b/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/CertificatesEventSource.cs index 5ec8b46b7e837..4f1bda23cac02 100644 --- a/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/CertificatesEventSource.cs +++ b/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/CertificatesEventSource.cs @@ -22,14 +22,14 @@ private CertificatesEventSource() : base(EventSourceName, EventSourceSettings.De [NonEvent] public void BeginUpdateStatus(CertificateOperationProperties properties) => - BeginUpdateStatus(properties?.Id.ToString(), properties?.Status, properties?.Error?.Message); + BeginUpdateStatus(properties?.Id.AbsoluteUri, properties?.Status, properties?.Error?.Message); [Event(BeginUpdateStatusEvent, Level = EventLevel.Verbose, Message = "Updating certificate operation status: {0}, current status: {1}, error: {2}")] public void BeginUpdateStatus(string id, string status, string error) => WriteEvent(BeginUpdateStatusEvent, id ?? Deleted, status, error ?? NoError); [NonEvent] public void EndUpdateStatus(CertificateOperationProperties properties) => - EndUpdateStatus(properties?.Id.ToString(), properties?.Status, properties?.Error?.Message); + EndUpdateStatus(properties?.Id.AbsoluteUri, properties?.Status, properties?.Error?.Message); [Event(EndUpdateStatusEvent, Level = EventLevel.Verbose, Message = "Updated certificate operation status: {0}, ending status: {1}, error: {2}")] public void EndUpdateStatus(string id, string status, string error) => WriteEvent(EndUpdateStatusEvent, id ?? Deleted, status, error ?? NoError); diff --git a/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/DeleteCertificateOperation.cs b/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/DeleteCertificateOperation.cs index 5ff5382988fe1..74344bde665cc 100644 --- a/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/DeleteCertificateOperation.cs +++ b/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/DeleteCertificateOperation.cs @@ -38,7 +38,7 @@ internal DeleteCertificateOperation(KeyVaultPipeline pipeline, Response - public override string Id => _value.Id.ToString(); + public override string Id => _value.Id.AbsoluteUri; /// /// Gets the . diff --git a/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/DeletedCertificate.cs b/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/DeletedCertificate.cs index e3ac744609b14..48034518c992f 100644 --- a/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/DeletedCertificate.cs +++ b/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/DeletedCertificate.cs @@ -27,7 +27,7 @@ internal DeletedCertificate(CertificateProperties properties = null) : base(prop public Uri RecoveryId { get => _recoveryId is null ? null : new Uri(_recoveryId); - internal set => _recoveryId = value?.ToString(); + internal set => _recoveryId = value?.AbsoluteUri; } /// diff --git a/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/KeyVaultCertificate.cs b/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/KeyVaultCertificate.cs index b28fc521e4d84..4e8a40e594d5e 100644 --- a/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/KeyVaultCertificate.cs +++ b/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/KeyVaultCertificate.cs @@ -39,7 +39,7 @@ internal KeyVaultCertificate(CertificateProperties properties = null) public Uri KeyId { get => new Uri(_keyId); - internal set => _keyId = value?.ToString(); + internal set => _keyId = value?.AbsoluteUri; } /// @@ -48,7 +48,7 @@ public Uri KeyId public Uri SecretId { get => new Uri(_secretId); - internal set => _secretId = value?.ToString(); + internal set => _secretId = value?.AbsoluteUri; } /// diff --git a/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/RecoverDeletedCertificateOperation.cs b/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/RecoverDeletedCertificateOperation.cs index 7332670ef1593..80c40e27f37a9 100644 --- a/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/RecoverDeletedCertificateOperation.cs +++ b/sdk/keyvault/Azure.Security.KeyVault.Certificates/src/RecoverDeletedCertificateOperation.cs @@ -32,7 +32,7 @@ internal RecoverDeletedCertificateOperation(KeyVaultPipeline pipeline, Response< protected RecoverDeletedCertificateOperation() {} /// - public override string Id => _value.Id.ToString(); + public override string Id => _value.Id.AbsoluteUri; /// /// Gets the of the certificate being recovered. diff --git a/sdk/keyvault/Azure.Security.KeyVault.Keys/src/Azure.Security.KeyVault.Keys.csproj b/sdk/keyvault/Azure.Security.KeyVault.Keys/src/Azure.Security.KeyVault.Keys.csproj index fdbe82acdc9f5..fb70a980d7e1c 100644 --- a/sdk/keyvault/Azure.Security.KeyVault.Keys/src/Azure.Security.KeyVault.Keys.csproj +++ b/sdk/keyvault/Azure.Security.KeyVault.Keys/src/Azure.Security.KeyVault.Keys.csproj @@ -11,7 +11,6 @@ $(RequiredTargetFrameworks) $(NoWarn);3021 true - false diff --git a/sdk/keyvault/Azure.Security.KeyVault.Keys/src/Cryptography/CryptographyClient.cs b/sdk/keyvault/Azure.Security.KeyVault.Keys/src/Cryptography/CryptographyClient.cs index 16e1e6f93ab05..d89e597a155d8 100644 --- a/sdk/keyvault/Azure.Security.KeyVault.Keys/src/Cryptography/CryptographyClient.cs +++ b/sdk/keyvault/Azure.Security.KeyVault.Keys/src/Cryptography/CryptographyClient.cs @@ -96,7 +96,7 @@ internal CryptographyClient(Uri keyId, TokenCredential credential, CryptographyC Argument.AssertNotNull(keyId, nameof(keyId)); Argument.AssertNotNull(credential, nameof(credential)); - _keyId = keyId.ToString(); + _keyId = keyId.AbsoluteUri; options ??= new CryptographyClientOptions(); RemoteCryptographyClient remoteClient = new RemoteCryptographyClient(new Uri(_keyId), credential, options); @@ -154,7 +154,7 @@ internal CryptographyClient(Uri keyId, KeyVaultPipeline pipeline) { Argument.AssertNotNull(keyId, nameof(keyId)); - _keyId = keyId.ToString(); + _keyId = keyId.AbsoluteUri; RemoteCryptographyClient remoteClient = new RemoteCryptographyClient(pipeline); @@ -1482,8 +1482,8 @@ internal byte[] CreateDigest(SignatureAlgorithm algorithm, byte[] data, string n { try { - using HashAlgorithm hashAlgo = algorithm.GetHashAlgorithm(); - return hashAlgo.ComputeHash(data); + using HashAlgorithm hashAlgorithm = algorithm.GetHashAlgorithm(); + return hashAlgorithm.ComputeHash(data); } catch (InvalidOperationException ex) when (LocalOnly) { @@ -1496,8 +1496,8 @@ internal byte[] CreateDigest(SignatureAlgorithm algorithm, Stream data, string n { try { - using HashAlgorithm hashAlgo = algorithm.GetHashAlgorithm(); - return hashAlgo.ComputeHash(data); + using HashAlgorithm hashAlgorithm = algorithm.GetHashAlgorithm(); + return hashAlgorithm.ComputeHash(data); } catch (InvalidOperationException ex) when (LocalOnly) { diff --git a/sdk/keyvault/Azure.Security.KeyVault.Keys/src/Cryptography/RemoteCryptographyClient.cs b/sdk/keyvault/Azure.Security.KeyVault.Keys/src/Cryptography/RemoteCryptographyClient.cs index 30fc3a8929253..f40099f6a7a1c 100644 --- a/sdk/keyvault/Azure.Security.KeyVault.Keys/src/Cryptography/RemoteCryptographyClient.cs +++ b/sdk/keyvault/Azure.Security.KeyVault.Keys/src/Cryptography/RemoteCryptographyClient.cs @@ -270,7 +270,7 @@ public virtual async Task> VerifyAsync(SignatureAlgorithm try { - return await Pipeline.SendRequestAsync(RequestMethod.Post, parameters, () => new VerifyResult { Algorithm = algorithm, KeyId = _keyId.ToString() }, cancellationToken, "/verify").ConfigureAwait(false); + return await Pipeline.SendRequestAsync(RequestMethod.Post, parameters, () => new VerifyResult { Algorithm = algorithm, KeyId = _keyId.AbsoluteUri }, cancellationToken, "/verify").ConfigureAwait(false); } catch (Exception e) { @@ -294,7 +294,7 @@ public virtual Response Verify(SignatureAlgorithm algorithm, byte[ try { - return Pipeline.SendRequest(RequestMethod.Post, parameters, () => new VerifyResult { Algorithm = algorithm, KeyId = _keyId.ToString() }, cancellationToken, "/verify"); + return Pipeline.SendRequest(RequestMethod.Post, parameters, () => new VerifyResult { Algorithm = algorithm, KeyId = _keyId.AbsoluteUri }, cancellationToken, "/verify"); } catch (Exception e) { diff --git a/sdk/keyvault/Azure.Security.KeyVault.Keys/src/DeleteKeyOperation.cs b/sdk/keyvault/Azure.Security.KeyVault.Keys/src/DeleteKeyOperation.cs index 4d52e57adc311..15cf60e342f45 100644 --- a/sdk/keyvault/Azure.Security.KeyVault.Keys/src/DeleteKeyOperation.cs +++ b/sdk/keyvault/Azure.Security.KeyVault.Keys/src/DeleteKeyOperation.cs @@ -38,7 +38,7 @@ internal DeleteKeyOperation(KeyVaultPipeline pipeline, Response resp protected DeleteKeyOperation() {} /// - public override string Id => _value.Id.ToString(); + public override string Id => _value.Id.AbsoluteUri; /// /// Gets the . diff --git a/sdk/keyvault/Azure.Security.KeyVault.Keys/src/DeletedKey.cs b/sdk/keyvault/Azure.Security.KeyVault.Keys/src/DeletedKey.cs index 8391cd859ca8e..60e78fe6f210c 100644 --- a/sdk/keyvault/Azure.Security.KeyVault.Keys/src/DeletedKey.cs +++ b/sdk/keyvault/Azure.Security.KeyVault.Keys/src/DeletedKey.cs @@ -31,7 +31,7 @@ internal DeletedKey(string name) : base(name) public Uri RecoveryId { get => _recoveryId is null ? null : new Uri(_recoveryId); - internal set => _recoveryId = value?.ToString(); + internal set => _recoveryId = value?.AbsoluteUri; } /// diff --git a/sdk/keyvault/Azure.Security.KeyVault.Keys/src/RecoverDeletedKeyOperation.cs b/sdk/keyvault/Azure.Security.KeyVault.Keys/src/RecoverDeletedKeyOperation.cs index de9648e7070e5..7681dfec62117 100644 --- a/sdk/keyvault/Azure.Security.KeyVault.Keys/src/RecoverDeletedKeyOperation.cs +++ b/sdk/keyvault/Azure.Security.KeyVault.Keys/src/RecoverDeletedKeyOperation.cs @@ -32,7 +32,7 @@ internal RecoverDeletedKeyOperation(KeyVaultPipeline pipeline, Response - public override string Id => _value.Id.ToString(); + public override string Id => _value.Id.AbsoluteUri; /// /// Gets the of the key being recovered. diff --git a/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/Azure.Security.KeyVault.Secrets.csproj b/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/Azure.Security.KeyVault.Secrets.csproj index 8ed923041eeaa..40847474f2b8c 100644 --- a/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/Azure.Security.KeyVault.Secrets.csproj +++ b/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/Azure.Security.KeyVault.Secrets.csproj @@ -11,7 +11,6 @@ $(RequiredTargetFrameworks) $(NoWarn);3021 true - false diff --git a/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/DeleteSecretOperation.cs b/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/DeleteSecretOperation.cs index cdf371e9b4169..98e42d5e9ae2b 100644 --- a/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/DeleteSecretOperation.cs +++ b/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/DeleteSecretOperation.cs @@ -38,7 +38,7 @@ internal DeleteSecretOperation(KeyVaultPipeline pipeline, Response - public override string Id => _value.Id.ToString(); + public override string Id => _value.Id.AbsoluteUri; /// /// Gets the . diff --git a/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/DeletedSecret.cs b/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/DeletedSecret.cs index e67232729d7aa..ad0cf5d317c47 100644 --- a/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/DeletedSecret.cs +++ b/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/DeletedSecret.cs @@ -31,7 +31,7 @@ internal DeletedSecret(SecretProperties properties = null) : base(properties) public Uri RecoveryId { get => _recoveryId is null ? null : new Uri(_recoveryId); - internal set => _recoveryId = value?.ToString(); + internal set => _recoveryId = value?.AbsoluteUri; } /// @@ -72,7 +72,7 @@ internal override void WriteProperties(Utf8JsonWriter json) if (RecoveryId != null) { - json.WriteString(s_recoveryIdPropertyNameBytes, RecoveryId.ToString()); + json.WriteString(s_recoveryIdPropertyNameBytes, RecoveryId.AbsoluteUri); } if (DeletedOn.HasValue) diff --git a/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/RecoverDeletedSecretOperation.cs b/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/RecoverDeletedSecretOperation.cs index 8fa7b06a755c3..26d061a1ca6a6 100644 --- a/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/RecoverDeletedSecretOperation.cs +++ b/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/RecoverDeletedSecretOperation.cs @@ -32,7 +32,7 @@ internal RecoverDeletedSecretOperation(KeyVaultPipeline pipeline, Response - public override string Id => _value.Id.ToString(); + public override string Id => _value.Id.AbsoluteUri; /// /// Gets the of the secret being recovered. diff --git a/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/SecretProperties.cs b/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/SecretProperties.cs index b26c236f5eba9..5174861695c84 100644 --- a/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/SecretProperties.cs +++ b/sdk/keyvault/Azure.Security.KeyVault.Secrets/src/SecretProperties.cs @@ -96,7 +96,7 @@ public SecretProperties(Uri id) public Uri KeyId { get => _keyId is null ? null : new Uri(_keyId); - internal set => _keyId = value?.ToString(); + internal set => _keyId = value?.AbsoluteUri; } /// diff --git a/sdk/keyvault/Azure.Security.KeyVault.Shared/src/KeyVaultPipeline.cs b/sdk/keyvault/Azure.Security.KeyVault.Shared/src/KeyVaultPipeline.cs index b4dbe64bf614e..b2346e7462cfd 100644 --- a/sdk/keyvault/Azure.Security.KeyVault.Shared/src/KeyVaultPipeline.cs +++ b/sdk/keyvault/Azure.Security.KeyVault.Shared/src/KeyVaultPipeline.cs @@ -127,7 +127,7 @@ public async Task> GetPageAsync(Uri firstPageUri, string nextLink, Fu responseAsPage.Deserialize(response.ContentStream); // convert from the Page to PageResponse - return Page.FromValues(responseAsPage.Items.ToArray(), responseAsPage.NextLink?.ToString(), response); + return Page.FromValues(responseAsPage.Items.ToArray(), responseAsPage.NextLink?.AbsoluteUri, response); } catch (Exception e) { @@ -158,7 +158,7 @@ public Page GetPage(Uri firstPageUri, string nextLink, Func itemFactory responseAsPage.Deserialize(response.ContentStream); // convert from the Page to PageResponse - return Page.FromValues(responseAsPage.Items.ToArray(), responseAsPage.NextLink?.ToString(), response); + return Page.FromValues(responseAsPage.Items.ToArray(), responseAsPage.NextLink?.AbsoluteUri, response); } catch (Exception e) { diff --git a/sdk/keyvault/samples/sharelink/ManagedStorageRestClient.cs b/sdk/keyvault/samples/sharelink/ManagedStorageRestClient.cs index ac0534f8e7d87..41fb53def8fc2 100644 --- a/sdk/keyvault/samples/sharelink/ManagedStorageRestClient.cs +++ b/sdk/keyvault/samples/sharelink/ManagedStorageRestClient.cs @@ -26,7 +26,7 @@ internal static ManagedStorageRestClient Create(Uri vaultUri, TokenCredential cr new ChallengeBasedAuthenticationPolicy(credential ?? throw new ArgumentNullException(nameof(credential)))); ClientDiagnostics diagnostics = new ClientDiagnostics(options); - return new ManagedStorageRestClient(diagnostics, pipeline, vaultUri.ToString()); + return new ManagedStorageRestClient(diagnostics, pipeline, vaultUri.AbsoluteUri); } } } diff --git a/sdk/keyvault/samples/sharelink/ShareLink.csproj b/sdk/keyvault/samples/sharelink/ShareLink.csproj index 6ceff5db6e4fe..2f0f302739deb 100644 --- a/sdk/keyvault/samples/sharelink/ShareLink.csproj +++ b/sdk/keyvault/samples/sharelink/ShareLink.csproj @@ -15,7 +15,6 @@ true true - false