question

JanuszJasinski-2456 avatar image
0 Votes"
JanuszJasinski-2456 asked JanuszJasinski-2456 commented

Microsoft.Azure.Cosmos.Table.StorageException

Hi All,

I'm getting this exception while running Azure function 2 in C#.
Function itself does not use Table Storage, so I'm pretty sure its some underlying Azure issue:

Error writing logs to table storage: Microsoft.Azure.Cosmos.Table.StorageException: Element 0 in the batch returned an unexpected response code. at Microsoft.Azure.Cosmos.Table.RestExecutor.TableCommand.Executor.ExecuteAsync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken token) at Microsoft.Azure.WebJobs.Logging.Utility.SafeExecuteAsync(CloudTable table, TableBatchOperation batch) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Logging\Internal\Utility.cs:line 178 at Microsoft.Azure.WebJobs.Logging.Utility.WriteBatchAsync[T](ILogTableProvider logTableProvider, IEnumerable`1 e1) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Logging\Internal\Utility.cs:line 268 at Microsoft.Azure.WebJobs.Logging.LogWriter.FlushTimelineAggregateAsync(Boolean always) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Logging\Internal\LogWriter.cs:line 265 at Microsoft.Azure.WebJobs.Logging.LogWriter.FlushCoreAsync() in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Logging\Internal\LogWriter.cs:line 316 Request Information RequestID:d0dd562f-f002-0062-7ec3-82aed8000000 RequestDate:Tue, 27 Jul 2021 08:42:32 GMT StatusMessage:0:This request is not authorized to perform this operation. ErrorCode: ErrorMessage:0:This request is not authorized to perform this operation. RequestId:d0dd562f-f002-0062-7ec3-82aed8000000 Time:2021-07-27T08:42:33.1540642Z

This popups on the end of the function logs.

KR

azure-functionsazure-table-storage
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Actually the issue was caused by storage account being set to private network and tables and queues where not exposed to the functions.
Learn this after some time, so I put it here just in case someone would run into it.

0 Votes 0 ·

1 Answer

PramodValavala-MSFT avatar image
0 Votes"
PramodValavala-MSFT answered

@JanuszJasinski-2456 Internally Functions uses Table Storage for logging if the AzureWebJobsDashboard app setting is set. It's recommended to use Application Insights for logging in production scenarios, so you can safely remove this and set the APPINSIGHTS_INSTRUMENTATIONKEY app setting instead.

If you plan to use Table Storage logs for other reasons, ensure that the connection string is correct and the firewall settings of your storage account.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.