Search code examples
azureazure-application-insightsazure-rest-api

Azure easiest way to publish and query a list of values


I am looking for the easiest and cheapest way to use Azure to publish a list of values to be query by my application. I am currently using Azure Application Insights to send telemetry events and try to use a similar mechanisms to serve my need. I tried to use the Azure Application Insight query and the tags but I can not find a good way to store the list of values.

I am wondering if a rest API would be the right way forward or if there is something even easier? The system is very similar to a revocation list:

  1. The list is published with no security (e.g. simply use the API key)
  2. The C# client starts and retrieves the list and perform some action is the list is successfully retrieved.

Any advice will be welcome.


Solution

  • Application insights is not a good place to store this kind of data. It will add many extra columns and the query results is not very friendly which may take you lots of time to parse it.

    For azure table storage, you can store the key and value pair into 2 different columns like mykeyColumn / myvalueColumn, then you can easy use the table storage sdk(it's available for both azure table storage and azure cosmos db services) to query the records(one or many) in just one query command.

    For better performance, I recommend you can store these key-value pairs with the same partition key, then in your code, you can define your query filter like below:

    TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "xxx")
    

    This filter will return all the key-value pairs in the specified partition key, next, you can easy to get each of them.

    For the usage of the sdk Microsoft.Azure.Cosmos.Table, please refer to this doc.

    For the usage of query filter, you may take a look at this doc(It may use the old sdk, but the query filter is the same).

    And if the key-value pairs will not be updated or no new ones will be added, you can also consider store them in json format, and use the blob storage.