Azure Function Service Bus - Managed Identity - Service Bus account connection string - node.js

I've followed the azure guides on setting up a managed identity for Service Bus. I'm running into the following error:
Service Bus account connection string 'ServiceBusConnection' does not exist.
I do have the "connection" in the function.json listed as "ServiceBusConnection"
In the live metrics I get this error when sending from the queue.
Service Bus account connection string 'ServiceBus' does not exist. Make sure that it is a defined App Setting.
I do have in my settings for the function app and locally the following configuration:
"ServiceBusConnection_fullyQualifiedNamespace":"<xxxxx>.servicebus.windows.net"
I've also defined AzureWebJobsStorage__accountName
I seem to be very stuck, followed the azure guides, can't find anything I'm doing wrong.

Wow, this took me too long to figure out, although I'm not sure why it behaves this way.
Looks like the error message I was getting was very telling.
I switched "ServiceBusConnection_fullyQualifiedNamespace" to "ServiceBus_fullyQualifiedNamespace" because it said Service Bus account connection string 'ServiceBus' does not exist.
This did work. I'm still unclear as to why I can't name the connection prefix as I please.
Connection string details here

Related

Azure Functions app settings prefix gets added

I've deployed an Azure Functions container to my AKS cluster. For some reason the function doesn't get loaded because of this error:
Storage account connection string 'AzureWebJobsAzureWebJobsStorage' does not exist
Now I do have an app setting in my local.settings.json called AzureWebJobsStorage, so I don't really know why I'm getting this error. In my function.json I'm only referring to AzureWebJobsStorage. Does anyone know?
The error that you are getting shows a connection string (AzureWebJobsAzureWebJobsStorage) that does not match what is in your settings (AzureWebJobsStorage). It sounds like there is a template copying error somewhere, as the setting should just be "AzureWebJobsStorage". Have you verified that the key is correct in local.settings.json?

Unable to deploy Azure Function App - error with storage account

Lately I've had trouble with deploying a Function App via Azure CLI. Last week on Tuesday, I was still able to deploy a Function App via Azure CLI.
This week, like any other day before that, I used fairly common Azure Function Tools command func azure functionapp publish. The version of Azure Function Tools I am using is 3.0.3233.
Now I am getting this error every time:
Retry: 1 of 3
Error creating a Blob container reference. Please make sure your connection string in "AzureWebJobsStorage" is valid
Retry: 2 of 3
Error creating a Blob container reference. Please make sure your connection string in "AzureWebJobsStorage" is valid
Retry: 3 of 3
Error creating a Blob container reference. Please make sure your connection string in "AzureWebJobsStorage" is valid
I checked that AzureWebJobsStorage setting has a correct value, I even connected to storage account connection string via Azure Storage Explorer app.
Just in case, I created a new Function App in another region and I still get the same error.
Has anyone else encountered this error? I suspect this is an error in the tool itself, maybe a faulty build?
I suspect that AzureWebJobsStorage is not present/invalid in App Settings section of the function app in the Azure portal.
Make sure that it is added there and you are not deleting those settings through CLI/templates and recreating them without AzureWebJobsStorage.
I answer to my own question. It seems that this was a transient error. Without changing any code, today I was able to redeploy my function app. Cheers.
If you don't have "Allow storage account key access" enabled , you get this error.
There could be other scenarios as well. But the error does not say anything .

Service Bus Connection String in Azure function is rejected

Im working through this guide using Azure Functions to commit IoTHub messages to Azure storage. I'm at section 5d, where I need to create a new Service Bus Connection string for my function, but whatever I use, including the format in the guide:
Endpoint=<Event Hub-compatible endpoint>;SharedAccessKeyName=iothubowner;SharedAccessKey=<Primary key>
I get the error:
Not a valid service bus connection string.
I’ve tried using the Event Hub-compatible endpoint from my IoT hub endpoints and also the connection string –- primary key from the access policy for iothubowner but again it rejects it.
I then created a new service bus and used that connection (see my answer below and initial optimism!) but when I tried to edit the function I get a 404 toast notification:
Function ($DeviceDataToStorage) Error: The listener for function
'Functions.DeviceDataToStorage' was unable to start.
Microsoft.ServiceBus: The messaging entity 'Management operation
failed. status-code: 404, status-description: The messaging entity
'sb://{MY SERVICE BUS CONNECTION STRING WHICH WAS
ACCEPTED}/{EVENTHUBNAME}' could not be found..' could not be found.
Can anyone who has used Azure functions before advise what format this needs to be in or more importantly where exactly in the portal I can get this from?
Thought I figured it out, but I hadn't.
Here's what I thought worked, but it didn't
*
Its missing from the tutorial, but you need to manually create a new
service bus endpoint (see
https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-dotnet-get-started-with-queues)
and copy the CONNECTIONSTRING-PRIMARYKEY from the
RootManageSharedAccessKey policy of Shared Access Policies.
*
According to your description, I checked this issue. As Prepare for IoT Hub connection to read messages states that you need to construct the connection string for your IoT hub endpoint as follows:
Endpoint={Event Hub-compatible endpoint};SharedAccessKeyName=iothubowner;SharedAccessKey={Primary key}
Replace {Event Hub-compatible endpoint} with:
Replace {Primary key} with:
Not a valid service bus connection string.
I assumed that you encounter this error when you creating a new Event Hub connection as follows:
When you add new connection string for your Event Hub, it should look like as follows:
Note: I assumed that you have confused with Service Bus connection string and IoT Hub connection string.
Connection string for Service Bus:
Endpoint=sb://{your-servicebus-name}.servicebus.windows.net/;SharedAccessKeyName={SharedAccessKeyName};SharedAccessKey={SharedAccessKey}

Azure WebJobs SDK ServiceBus connection string 'AzureWebJobsAzureSBConnection' is missing or empty

I created an Azure Function App in Visual Studio 2015. The App has a trigger for service bus queues. The app works perfectly when I run it locally. It is able to read the data from the Service Bus queue (configured via a variable named AzureSBConnection) and log it in my database.
But it gives me the following error when deployed in Azure:
Function ($ServiceBusQueueTriggerFunction) Error: Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.ServiceBusQueueTriggerFunction'. Microsoft.Azure.WebJobs.ServiceBus: Microsoft Azure WebJobs SDK ServiceBus connection string 'AzureWebJobsAzureSBConnection' is missing or empty.
Note that my connection is called AzureSBConnection and not AzureWebJobsAzureSBConnection. Also, the connection works locally. And finally, the deployed file looks exactly like the local file.
The Visual Studio structure looks like the following:
The function.json file has a bunch of settings as shown below:
Then in the Appsettings.json file, I have the following:
For deploying, I FTPed the files to the D:\home\site\wwwroot location for my Function App in Azure. The final structure in Kudu looks like:
And if I go inside my function folder:
Here is the deployed function.json:
And here is the deployed appsettings:
The deployed json files are exactly the same as the local files. But the deployed version is erroring out because of the missing AzureWebJobsAzureSBConnection. What am I doing wrong?
Only environment variables are supported for app settings and connection strings.
You need to make sure that the environment variable AzureWebJobsAzureSBConnection is set on your Function's app settings in the portal:
and then once there, you need to add the AzureWebJobsAzureSBConnection variable with the proper connection string:
and then you can access this via code by:
Environment.GetEnvironmentVariable(name, EnvironmentVariableTarget.Process);
This will obtain the value from either the appsettings.json or the environment variable depending on where the function is being executed from, (local debugging or deployed on Azure)
It is able to read the data from the Service Bus queue (configured via a variable named AzureSBConnection) But it gives me the following error when deployed in Azure:
After you deployed your application to Azure Function, your application will read the connection string from environment setting. Currently, connection settings in appsettings.json will not update environment setting automatically. We could click [Configure app settings] button as #flyte mentioned to check whether the connection string is configured successfully. If not, you could add it manually in app setting box.
Note that my connection is called AzureSBConnection and not AzureWebJobsAzureSBConnection
Please go to [Integrate] page to check whether the [Service Bus connection] is configured successfully. If not, you could reset it by clicking the [new] link.

40400 Endpoint not found-error from Azure service bus (App function)

Im trying to create an "azure app function", that is listening on a Service Bus queue. Im using the quick start-method, so the only writing so far has been inserting the connection string
I have created a service bus instance and a queue and a policy permission (listen). I copied that connection string and removed the last part of it, so I my connection string is connection
Endpoint=sb://bla.servicebus.windows.net/;SharedAccessKeyName=bla-policy-principal-queue-listen;SharedAccessKey=<thekey>
I get error message :
Microsoft.ServiceBus: 40400: Endpoint not found., Resource:sb://bla.servicebus.windows.net/mysbqueue0.
I have seen a couple of similar questions but not for app functions, and the answers didnt make any sense to me. There are no code except the logging that was in the template
Im sending the messages from dynamics 365. Do I have to register the listener somewhere?
All suggestions are welcome, troubleshooting, or anything :)
You need to specify queue name aswell

Resources