When working with Azure Table Storage and Application Insights you might have noticed a lot of dependency errors, logging a 409 Conflict event everytime the CreateIfNotExists() method is called to make sure a table is available.
This is because the Azure.Data.Tables SDK will simply try to create a new table — and will hide the error if it already exists. While you don’t notice this in the code, by default Application Insights will catch this and clutter your logs with errors you probably don’t want.
To avoid this you can either configure the type of events Application Insights catches, or you can manually check if a table exists before trying to create it. Since this seamed a bit easier I’ve opted for option #2:
Note: I’m using the ToListAsync() method from the System.Linq.Async NuGet package to get all results from my queries without having to handle paging myself.