Describe the bug
AzureBlobLuggageOptions offers two ways to connect: ContainerUri with Credential, or ConnectionString with ContainerName. The second one cannot be used at the moment, because the check in the constructor is inverted:
else if (string.IsNullOrEmpty(options.ContainerName) && string.IsNullOrEmpty(options.ConnectionString))
{
_blobClient = new BlobContainerClient(options.ConnectionString, options.ContainerName);
}
else
{
throw new ArgumentException("", nameof(options));
}
With both values set, the constructor throws an ArgumentException with an empty message. The tests in Paramore.Brighter.Azure.Tests construct the store only with ContainerUri and AzureCliCredential, which is probably why this has not come up.
The options' own XML docs describe the connection-string path as "Suitable for development or when using shared access signatures (SAS) or account keys via a connection string". For Azurite, which serves plain http by default, it is also the only path: the ContainerUri one fails there, because the SDK refuses a TokenCredential over http ("Cannot use TokenCredential without HTTPS").
The fix looks small: negate both checks, and name the two supported combinations in the exception message.
To Reproduce
var store = new AzureBlobLuggageStore(new AzureBlobLuggageOptions
{
ConnectionString = "UseDevelopmentStorage=true",
ContainerName = "luggage"
});
Exceptions (if any)
System.ArgumentException: (Parameter 'options')
Further technical details
- Brighter version: 10.7.0
- Azure.Storage.Blobs 12.29.1
Prepared with help of an AI assistant.
Describe the bug
AzureBlobLuggageOptionsoffers two ways to connect:ContainerUriwithCredential, orConnectionStringwithContainerName. The second one cannot be used at the moment, because the check in the constructor is inverted:With both values set, the constructor throws an
ArgumentExceptionwith an empty message. The tests inParamore.Brighter.Azure.Testsconstruct the store only withContainerUriandAzureCliCredential, which is probably why this has not come up.The options' own XML docs describe the connection-string path as "Suitable for development or when using shared access signatures (SAS) or account keys via a connection string". For Azurite, which serves plain http by default, it is also the only path: the
ContainerUrione fails there, because the SDK refuses aTokenCredentialover http ("Cannot use TokenCredential without HTTPS").The fix looks small: negate both checks, and name the two supported combinations in the exception message.
To Reproduce
Exceptions (if any)
Further technical details
Prepared with help of an AI assistant.