azure-webjobs-sdk
azure-webjobs-sdk copied to clipboard
QueueTriggerAttribute QueueAttribute SAS Uri support
An azure function needs to be linked to a couple of Azure Storage Queues. One as input, and another one as output. For security reasons, I need to use SAS Uri. I don't want to use a full access connection string to the whole storage account. I would like to use a SAS Uri with the minimal access rights for reading and writing a specific queue.
[FunctionName("MyFunct")]
public async static Task Run([QueueTrigger("myqueueIN", Connection = "ApplicationQueueInputURI")] string inputItem,
[Queue("myqueueOUT", Connection = "ApplicationQueueOutputURI")] ICollector<string> outputItems,
ILogger log)
With this configuration:
"ApplicationQueueInputURI" : "https://xxxxxxxxxxxx.queue.core.windows.net/myqueueIN?si=fullaccess&spr=ht...."
"ApplicationQueueOutputURI" : "https://xxxxxxxxxxxx.queue.core.windows.net/myqueueOUT?si=fullaccess&spr=ht...."
As far as I know QueueTriggerAttribute and QueueAttribute do not support SAS Uri for connecting to Azure Storage Queue. In fact I get this error:
The 'MyFunct' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'MyFunct'. System.Private.CoreLib: Exception has been thrown by the target of an invocation. Azure.Storage.Queues: No valid combination of account information found.
Is this the expected behavior? Do you have any plan to support SAS Uri in QueueTriggerAttribute and QueueAttribute ?
Thanks for reporting pls follow the updated doc for this. microsoft
pls share invocation id ,timestamp region.
Thanks for reporting pls follow the updated doc for this.
What documentation? link?
pls share invocation id ,timestamp region.
I reverted to use a normal connection string. Please, give some days to create a test project from scratch and run it again.
I cannot give you an invocationID because the function is disabled during startup. I see the same behavior locally, using the Visual Studio Functions runtime.
The error is:
The 'queuetest' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'queuetest'.
System.Private.CoreLib: Exception has been thrown by the target of an invocation.
Azure.Storage.Queues: No valid combination of account information found.
If I deploy the function to Azure, from application insights, under exceptions, I see the same error:
Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException
Error indexing method 'queuetest'
No valid combination of account information found.
(full error at the end of this message)
My test function is very simple:
[FunctionName("queuetest")]
public void Run(
[QueueTrigger("queuetest-in", Connection = "SASTestQueueIN")] string myQueueItem,
[Queue("queuetest-out", Connection = "SASTestQueueOUT")] ICollector<string> outputItems,
ILogger log)
{
log.LogInformation($"C# Queue trigger function processed: {myQueueItem}");
outputItems.Add($"Output: {myQueueItem}");
}
In configuration I have:
"SASTestQueueIN": "https://xxxxxxxxxxxxxxx.queue.core.windows.net/sastestqueuein?sv=2020-08-04&si=fullaccess&sig=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"SASTestQueueOUT": "https://xxxxxxxxxxxxxxx.queue.core.windows.net/sastestqueueout?sv=2020-08-04&si=fullaccess&sig=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
For your information, I have found a similar issue:
https://github.com/Azure/azure-sdk-for-net/issues/32639
Full error from Azure Application Insigths:
[{"id":"66476022","outerId":"0","type":"Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException","message":"Error indexing method 'queuetest'","parsedStack":[{"level":0,"method":"Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexMethodAsync>d__21.MoveNext","assembly":"Microsoft.Azure.WebJobs.Host, Version=3.0.39.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35","line":157,"fileName":"D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Indexers\FunctionIndexer.cs"},{"level":1,"method":"System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw","assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","line":0},{"level":2,"method":"System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess","assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","line":0},{"level":3,"method":"System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification","assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","line":0},{"level":4,"method":"System.Runtime.CompilerServices.TaskAwaiter.GetResult","assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","line":0},{"level":5,"method":"Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexTypeAsync>d__17.MoveNext","assembly":"Microsoft.Azure.WebJobs.Host, Version=3.0.39.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35","line":85,"fileName":"D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Indexers\FunctionIndexer.cs"}],"severityLevel":"Error"},{"id":"61413291","outerId":"66476022","type":"System.Reflection.TargetInvocationException","message":"Exception has been thrown by the target of an invocation.","parsedStack":[{"level":0,"method":"System.RuntimeMethodHandle.InvokeMethod","assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","line":0},{"level":1,"method":"System.Reflection.RuntimeConstructorInfo.Invoke","assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","line":0},{"level":2,"method":"Microsoft.Extensions.Azure.ClientFactory.CreateClient","assembly":"Microsoft.Extensions.Azure, Version=1.6.3.0, Culture=neutral, PublicKeyToken=92742159e12e44c8","line":0},{"level":3,"method":"Microsoft.Extensions.Azure.AzureComponentFactoryImpl.CreateClient","assembly":"Microsoft.Extensions.Azure, Version=1.6.3.0, Culture=neutral, PublicKeyToken=92742159e12e44c8","line":0},{"level":4,"method":"Microsoft.Azure.WebJobs.Extensions.Clients.Shared.StorageClientProvider2.CreateClient","assembly":"Microsoft.Azure.WebJobs.Extensions.Storage.Queues, Version=5.1.3.0, Culture=neutral, PublicKeyToken=92742159e12e44c8","line":0},{"level":5,"method":"Microsoft.Azure.WebJobs.Extensions.Storage.Queues.QueueServiceClientProvider.CreateClient","assembly":"Microsoft.Azure.WebJobs.Extensions.Storage.Queues, Version=5.1.3.0, Culture=neutral, PublicKeyToken=92742159e12e44c8","line":0},{"level":6,"method":"Microsoft.Azure.WebJobs.Extensions.Clients.Shared.StorageClientProvider
2.Get","assembly":"Microsoft.Azure.WebJobs.Extensions.Storage.Queues, Version=5.1.3.0, Culture=neutral, PublicKeyToken=92742159e12e44c8","line":0},{"level":7,"method":"Microsoft.Azure.WebJobs.Extensions.Clients.Shared.StorageClientProvider2.Get","assembly":"Microsoft.Azure.WebJobs.Extensions.Storage.Queues, Version=5.1.3.0, Culture=neutral, PublicKeyToken=92742159e12e44c8","line":0},{"level":8,"method":"Microsoft.Azure.WebJobs.Extensions.Storage.Queues.Triggers.QueueTriggerAttributeBindingProvider.TryCreateAsync","assembly":"Microsoft.Azure.WebJobs.Extensions.Storage.Queues, Version=5.1.3.0, Culture=neutral, PublicKeyToken=92742159e12e44c8","line":0},{"level":9,"method":"Microsoft.Azure.WebJobs.Host.Triggers.CompositeTriggerBindingProvider+<TryCreateAsync>d__2.MoveNext","assembly":"Microsoft.Azure.WebJobs.Host, Version=3.0.39.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35","line":20,"fileName":"D:\\a\\_work\\1\\s\\src\\Microsoft.Azure.WebJobs.Host\\Triggers\\CompositeTriggerBindingProvider.cs"},{"level":10,"method":"System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw","assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","line":0},{"level":11,"method":"System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess","assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","line":0},{"level":12,"method":"System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification","assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","line":0},{"level":13,"method":"System.Runtime.CompilerServices.TaskAwaiter
1.GetResult","assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","line":0},{"level":14,"method":"Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexMethodAsyncCore>d__22.MoveNext","assembly":"Microsoft.Azure.WebJobs.Host, Version=3.0.39.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35","line":172,"fileName":"D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Indexers\FunctionIndexer.cs"},{"level":15,"method":"System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw","assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","line":0},{"level":16,"method":"System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess","assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","line":0},{"level":17,"method":"System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification","assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","line":0},{"level":18,"method":"System.Runtime.CompilerServices.TaskAwaiter.GetResult","assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e","line":0},{"level":19,"method":"Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexMethodAsync>d__21.MoveNext","assembly":"Microsoft.Azure.WebJobs.Host, Version=3.0.39.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35","line":149,"fileName":"D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Indexers\FunctionIndexer.cs"}],"severityLevel":"Error"},{"id":"8420641","outerId":"61413291","type":"System.FormatException","message":"No valid combination of account information found.","parsedStack":[{"level":0,"method":"Azure.Storage.StorageConnectionString+<>c.<Parse>b__67_0","assembly":"Azure.Storage.Queues, Version=12.14.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8","line":0},{"level":1,"method":"Azure.Storage.StorageConnectionString.ParseCore","assembly":"Azure.Storage.Queues, Version=12.14.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8","line":0},{"level":2,"method":"Azure.Storage.StorageConnectionString.Parse","assembly":"Azure.Storage.Queues, Version=12.14.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8","line":0},{"level":3,"method":"Azure.Storage.Queues.QueueServiceClient..ctor","assembly":"Azure.Storage.Queues, Version=12.14.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8","line":0}],"severityLevel":"Error"}]
@fabiocav pls comment.Thanks