I have a program where I build an envelope based on an HTTP Request. My next step is to take this envelope and add it to the Storage Queue so that I can then add the payload from the envelope to a Cosmos DB. It seems as if I am unable to connect to my Storage Account.
This is my code that actually sends the envelope to the Storage account:
import com.azure.storage.queue.QueueClientBuilder;
import com.azure.storage.queue.models.QueueStorageException;
import com.azure.storage.queue.QueueClient;
public class StorageQueueSend {
public static String send(CfLog envelope) {
try {
QueueClient queueClient = new QueueClientBuilder()
.connectionString("AzureWebJobsStorage")
.queueName("hyperscalerapistorage-queue")
.buildClient();
queueClient.sendMessage(envelope.toString());
return "Envelope added to storage queue\n";
} catch(QueueStorageException e) {
return e.getMessage();
}
}
}
hyperscalerapistorage-queue is the name of my queue. My connection string is stored in my local.settings.json as "AzureWebJobsStorage". And I have the proper connection string also stored in an Application Setting called "AzureWebJobsStorage" in my Function App. Here is the error message I am receiving:
[2023-02-23T20:15:59.682Z] Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.create'. System.Private.CoreLib: Exception has been thrown by the target of an invocation. Azure.Storage.Queues: No valid combination of account information found.
[2023-02-23T20:15:59.691Z] Error indexing method 'Functions.create'
[2023-02-23T20:15:59.696Z] Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.create'. System.Private.CoreLib: Exception has been thrown by the target of an invocation. Azure.Storage.Queues: No valid combination of account information found.
[2023-02-23T20:15:59.708Z] Function 'Functions.create' failed indexing and will be disabled.
[2023-02-23T20:16:00.022Z] Listening for transport dt_socket at address: 5005
[2023-02-23T20:16:00.077Z] The 'create' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.create'. System.Private.CoreLib: Exception has been thrown by the target of an invocation. Azure.Storage.Queues: No valid combination of account information found.
local.settings.jsonin your code; you're passing the literal string "AzureWebJobsStorage" as your connection string. You need to read it from your settings file first.