Search code examples
azureazure-table-storageazure-function-app-proxy

Table storage RowKey ,Partition Key


Could someone please tell me whether it is possible to assign same value for both Partitionkey and Rowkey in Azure Functionapp?

Many Thanks in advance


Solution

  • Based on your description, I just created my Http Trigger for Node.js to check this issue.

    function.json:

    {
      "bindings": [
        {
          "authLevel": "function",
          "type": "httpTrigger",
          "direction": "in",
          "name": "req"
        },
        {
          "type": "http",
          "direction": "out",
          "name": "res"
        },
        {
          "type": "table",
          "name": "outputTable",
          "tableName": "emails",
          "connection": "AzureWebJobsDashboard",
          "direction": "out"
        }
      ],
      "disabled": false
    }
    

    index.js:

    var date=Date.now();
    var key=date+'-'+Math.ceil(Math.random()*1000);
    context.bindings.outputTable = {
        "partitionKey": key,
        "rowKey":key,
        "GPIOPin":2,
        'status':true
    };
    

    Leverage Azure Storage Explorer to check my table as follows:

    enter image description here

    For more details about the output sample for Table storage binding, you could refer to here.