Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QueueTriggerAttribute QueueAttribute SAS Uri support #3039

Open
fhtino opened this issue Nov 5, 2023 · 5 comments
Open

QueueTriggerAttribute QueueAttribute SAS Uri support #3039

fhtino opened this issue Nov 5, 2023 · 5 comments

Comments

@fhtino
Copy link

fhtino commented Nov 5, 2023

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 ?

@bhagyshricompany bhagyshricompany self-assigned this Nov 6, 2023
@bhagyshricompany
Copy link

Thanks for reporting pls follow the updated doc for this. microsoft

@bhagyshricompany
Copy link

pls share invocation id ,timestamp region.

@fhtino
Copy link
Author

fhtino commented Nov 7, 2023

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.

@fhtino
Copy link
Author

fhtino commented Nov 11, 2023

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:

Azure/azure-sdk-for-net#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+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+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.StorageClientProvider2.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.TaskAwaiter1.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+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+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.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"}]

@bhagyshricompany
Copy link

bhagyshricompany commented Nov 14, 2023

@fabiocav pls comment.Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants