Skip to content
This repository was archived by the owner on Aug 3, 2024. It is now read-only.

Commit 34afff6

Browse files
committed
Build fix
1 parent 7637864 commit 34afff6

2 files changed

Lines changed: 7 additions & 13 deletions

File tree

src/NuGet.Services.KeyVault/KeyVaultReader.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ public class KeyVaultReader : ISecretReader
1919
private readonly KeyVaultConfiguration _configuration;
2020
private readonly Lazy<SecretClient> _keyVaultClient;
2121

22-
protected string VaultBaseUrl => _vault;
23-
protected KeyVaultClient KeyVaultClient => _keyVaultClient.Value;
22+
protected SecretClient KeyVaultClient => _keyVaultClient.Value;
2423

2524
public KeyVaultReader(KeyVaultConfiguration configuration)
2625
{

src/NuGet.Services.KeyVault/KeyVaultWriter.cs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33

44
using System;
55
using System.Threading.Tasks;
6-
using Microsoft.Azure.KeyVault;
7-
using Microsoft.Azure.KeyVault.Models;
6+
using Azure.Core;
7+
using Azure.Identity;
8+
using Azure.Security.KeyVault.Secrets;
89

910
namespace NuGet.Services.KeyVault
1011
{
@@ -19,16 +20,10 @@ public async Task SetSecretAsync(
1920
string secretValue,
2021
DateTimeOffset? expiration = null)
2122
{
22-
SecretAttributes attributes = null;
23-
if (expiration.HasValue)
24-
{
25-
attributes = new SecretAttributes
26-
{
27-
Expires = expiration.Value.UtcDateTime,
28-
};
29-
}
23+
var secret = new Azure.Security.KeyVault.Secrets.KeyVaultSecret(secretName, secretValue);
24+
secret.Properties.ExpiresOn = expiration;
3025

31-
await KeyVaultClient.SetSecretAsync(VaultBaseUrl, secretName, secretValue, secretAttributes: attributes);
26+
await KeyVaultClient.SetSecretAsync(secret);
3227
}
3328
}
3429
}

0 commit comments

Comments
 (0)