AzureKeyCredential
Key credential used to authenticate to an Azure Service.
It provides the ability to update the key without creating a new client.
using Azure.Core;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Threading;
namespace Azure
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public class AzureKeyCredential
{
private string _key;
[EditorBrowsable(EditorBrowsableState.Never)]
public string Key {
get {
return Volatile.Read(ref _key);
}
private set {
Volatile.Write(ref _key, value);
}
}
public AzureKeyCredential(string key)
{
Update(key);
}
public void Update(string key)
{
Argument.AssertNotNullOrEmpty(key, "key");
Key = key;
}
}
}