I'm trying to search an Azure blob container for images using tags.
Here is my connection string:
<add key="blobConnString" value="DefaultEndpointsProtocol=https;AccountName=XXXX;AccountKey=XXXXXXXXXXXX;EndpointSuffix=core.windows.net"/>
Here is my method:
private void FindFiles()
{
var foundItems = new List<TaggedBlobItem>();
var connectionString = ConfigurationManager.AppSettings["blobConnString"];
var _client = new BlobServiceClient(connectionString);
var blobs = _client.FindBlobsByTags("@container = 'images' AND 'invID' = '12345'");
foreach (var blob in blobs)
{
foundItems.Add(blob);
}
}
And this is the error I get:
Error: Azure.RequestFailedException: Value for one of the query parameters specified in the request URI is invalid.
RequestId:7434f0b1-501e-0001-07a5-4ef3e1000000
Time:2022-04-12T19:45:01.1081429Z
Status: 400 (Value for one of the query parameters specified in the request URI is invalid.)
ErrorCode: InvalidQueryParameterValue
Additional Information:
QueryParameterName: comp
QueryParameterValue: blobs
Reason:
Content:
<?xml version="1.0" encoding="utf-8"?><Error><Code>InvalidQueryParameterValue</Code><Message>Value for one of the query parameters specified in the request URI is invalid.
RequestId:7434f0b1-501e-0001-07a5-4ef3e1000000
Time:2022-04-12T19:45:01.1081429Z</Message><QueryParameterName>comp</QueryParameterName><QueryParameterValue>blobs</QueryParameterValue><Reason /></Error>
Headers:
Server: Microsoft-HTTPAPI/2.0
x-ms-request-id: 7434f0b1-501e-0001-07a5-4ef3e1000000
x-ms-client-request-id: c522b1bc-ce28-4c48-a593-dfbb6d81af66
x-ms-error-code: InvalidQueryParameterValue
Date: Tue, 12 Apr 2022 19:45:00 GMT
Content-Length: 376
Content-Type: application/xml
at Azure.Storage.Blobs.ServiceRestClient.FilterBlobs(Nullable`1 timeout, String where, String marker, Nullable`1 maxresults, CancellationToken cancellationToken)
at Azure.Storage.Blobs.BlobServiceClient.FindBlobsByTagsInternal(String marker, String expression, Nullable`1 pageSizeHint, Boolean async, CancellationToken cancellationToken)
at Azure.Storage.Blobs.Models.FilterBlobsAsyncCollection.GetNextPageAsync(String continuationToken, Nullable`1 pageSizeHint, Boolean async, CancellationToken cancellationToken)
at Azure.Core.Pipeline.TaskExtensions.EnsureCompleted[T](ValueTask`1 task)
at Azure.Storage.StorageCollectionEnumerator`1.StoragePageable.GetEnumerator()+MoveNext()
at CosmosGettingStartedTutorial.Program.FindFiles() in C:\Users\Drew\Downloads\DocumentDB-Quickstart-DotNet\sql-dotnet\CosmosGettingStartedTutorial\Program.cs:line 297
at CosmosGettingStartedTutorial.Program.GetStartedDemoAsync() in C:\Users\Drew\Downloads\DocumentDB-Quickstart-DotNet\sql-dotnet\CosmosGettingStartedTutorial\Program.cs:line 78
at CosmosGettingStartedTutorial.Program.Main(String[] args) in C:\Users\Drew\Downloads\DocumentDB-Quickstart-DotNet\sql-dotnet\CosmosGettingStartedTutorial\Program.cs:line 45
End of demo, press any key to exit.