BlobTrigger in Functions Runtime preview 2 with local storage account - azure

I have the Functions Runtime preview 2 installed .
I was able to create and run functions with timer trigger. But the Blob trigger doesn't , seem to 'trigger'.
I am using local azure explorer ( local development blob container) as my trigger source.
Is this a known issue?
i notice that the mouseover in 'integrate' section shows endpoint protocol as https. i specified http endpoint when creating it( since thats what the local storage emulator supports). but runtime seems to be picking up https on its own.

I was able to create and run functions with timer trigger. But the Blob trigger doesn't , seem to 'trigger'.
It seems that the issue is your storage account connection string. You only write the Blob endpoint in your connection string. If you don't want to use 'UseDevelopmentStorage=true', You need to write the complete connection string instead:
DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;
You could also check the function logs on your side. Maybe there is an error.
i notice that the mouseover in 'integrate' section shows endpoint protocol as https
I have tested on my side, the system is based on endpoint url 'http'. Even if the DefaultEndpointsProtocol=https, we still could use the storage connection string successfully. If we setDefaultEndpointsProtocol=http and endpoint url to 'https', the connection string would not work.

Related

Azure Data Explorer oneclick Ingest from blob container (UI)

I'm trying to configure and use the Azure Data Explorer OneClick Ingest from blob container (continous ingest).
Whatever I try the URL is never accepted, I always end up with this error:
Invalid URL. Either the URL leads to a blob instead of a container, or the permissions are incorrect. If you just grant permission, please wait couple of minutes and try again.
The URL I'm using follow that pattern:
https://mystorageaccount.blob.core.windows.net/mycontainer?sp=rl&st=2022-04-26T22:01:42Z&se=2032-04-27T06:01:42Z&spr=https&sv=2020-08-04&sr=c&sig=Z4Mlh7s5%2Fm1890kdfzlkYLSIHHDdGJmTSyYXVYsHdn01o%3D
I'm probably missing something, either in the URL syntax ou SAS generation.
Has anyone successfully used it? Any idea what could be wrong?
Thanks
I finally found out what was the issue.
Probably due to the security in place on my Storage account I had to create in Azure Data Explorer Networking panel, a Managed private enpoint, pointing to my storage resource (and then approve that endpoint in the storage account Networking)
https://learn.microsoft.com/en-us/azure/data-explorer/security-network-managed-private-endpoint-create

Why do I see a FunctionIndexingException when creating a QueueTrigger WebJob Function?

I created a function like this
public static Task HandleStorageQueueMessageAsync(
[QueueTrigger("%QueueName%", Connection = "%ConnectionStringName%")] string body,
TextWriter logger)
{
if (logger == null)
{
throw new ArgumentNullException(nameof(logger));
}
logger.WriteLine(body);
return Task.CompletedTask;
}
The queue name and the connection string name come from my configuration that has an INameResolver to get the values. The connection string itself I put from my secret store into the app config at app start. If the connection string is a normal storage connection string granting all permissions for the whole account, the method works like expected.
However, in my scenario I am getting an SAS from a partner team that only offers read access to a single queue. I created a storage connection string from that which looks similar like
QueueEndpoint=https://accountname.queue.core.windows.net;SharedAccessSignature=st=2017-09-24T07%3A29%3A00Z&se=2019-09-25T07%3A29%3A00Z&sp=r&sv=2018-03-28&sig=token
(I tried successfully to connect using this connection string in Microsoft Azure Storage Explorer)
The queue name used in the QueueTrigger attribute is also gathered from the SAS
However, now I am getting the following exceptions
$exception {"Error indexing method 'Functions.HandleStorageQueueMessageAsync'"} Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException
InnerException {"No blob endpoint configured."} System.Exception {System.InvalidOperationException}
If you look at the connection string, you can see the exception is right. I did not configure the blob endpoint. However I also don't have access to it and neither do I want to use it. I'm using the storage account only for this QueueTrigger.
I am using Microsoft.Azure.WebJobs v2.2.0. Other dependencies prevent me from upgrading to a v3.x
What is the recommended way for consuming messages from a storage queue when only a SAS URI with read access to a single queue is available? If I am already on the right path, what do I need to do in order to get rid of the exception?
As you have seen, v2 WebJobs SDK requires access to blob endpoint as well. I am afraid it's by design, using connection string without full access like SAS is an improvement tracked but not realized yet.
Here are the permissions required by v2 SDK. It needs to get Blob Service properties(Blob,Service,Read) and Queue Metadata and process messages(Queue,Container&Object,Read&Process).
Queue Trigger is to get messages and delete them after processing, so SAS requires Process permission. It means the SAS string you got is not authorized correctly even if SDK doesn't require blob access.
You could ask partner team to generate SAS Connection String on Azure portal with minimum permissions above. If they can't provide blob access, v3 SDK seems an option to try.
But there are some problems 1. Other dependencies prevent updating as you mentioned 2. v3 SDK is based on .NET Core which means code changes can't be avoided. 3. v3 SDK document and samples are still under construction right now.
I was having a load of issues getting a SAS token to work for a QueueTrigger.
Not having blob included was my problem. Thanks Jerry!
Slightly newer screenshot (I need add also):

Stream Analytics Function Output Unable to Connect

For some reason, I'm unable to make the connection from Stream Analytics to my Azure Function as an output. I have this exact pipeline set up and working in my own Azure subscription, but can't get this output connection to work in my dev environment.
Unable to load subscriptions PIC
First, the drop-down does not load the available function apps and functions in the subscription, as seen above. There are multiple that are in the subscription and are running, so this should populate. Instead, I see the error "Failed to load function apps" and "Failed to load functions."
Second, when I try to fill in the fields manually (after selecting "Provide azure function settings manually") I am also unable to connect. To do this, I'm giving the output a unique name, then copy/pasting the function app name and function name to the blanks. For the key, I've tried many variations to no avail. My function currently has Authorization set to anonymous, and I've tried leaving the key field blank. I've also tried using the "Function" key on my function, as well as the _master and default access keys. Each give me an error message when testing output connection. How do I get this connected?
Manual function setup PIC
Here is the error that I get
Error PIC
UPDATE - I'm still working on this, but at least part of it was due to having a hyphen "-" in the function name. Apparently Azure doesn't like that. Once I fixed the function name I'm able to trigger the function manually from within the Azure portal and externally through Postman, but still the connection test is failing from Stream Analytics.
UPDATE 2 - My temporary work around has been to have Stream Analytics post its output to an Event Hub, and trigger a function off of the Event Hub's traffic.

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.

Azure Functions Proxy - route to storage account

I could create an azure function proxy with success that routes requests to my blob storage. However, it only works if I specify the Backend URL with the full url to the blob file:
ex:
https://account.blob.core.windows.net/site/index.html
where '/site' is my container name and 'index.html' is my blob name.
I had an understanding that I could use the route template as '/site' and if I leave the Backend URL as 'https://account.blob.core.windows.net/site/' what comes after the last '/' would be routed to my storage account. Did I understand wrong?
UPDATE
After reading this other question Azure Function App Proxy to a blob storage account and update the route template / backend url it works, but if my blob name has an extension it does not work (such as .html). Any clues?
Yes we have identified a bug when URL ends with an .extension and will release the fix in the next few days. Thanks much for the feedback.
In the Azure Functions Proxy documentation they specify how to get the request parameters and pass those to your backend service.
Your template can be /site/{*restOfPath}
And your backend would be https://account.blob.core.windows.net/site/{restOfPath}
I was able to get this working only on files that do NOT have a file extension. So I was able to add an index blob and get to it from https://myfunction.azurewebsites.net/index, however, when I tried index.html, the proxy returned a message "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."

Resources