Lets move on from 5 min Logic App
Azure Table Storage Connector
Azure Table Storage – Connectors | Microsoft Docs
Azure Table storage is a service that stores structured NoSQL data in the cloud, providing a key/attribute store with a schemaless design
https://docs.microsoft.com/en-us/rest/api/storageservices/understanding-the-table-service-data-model
PartitionKey Property:
A table’s entities are organized by partition. A partition is a consecutive range of entities possessing the same partition key value. The partition key is a unique identifier for the partition within a given table, specified by the PartitionKey property. The partition key forms the first part of an entity’s primary key. The partition key may be a string value up to 1 KiB in size.
RowKey Property
The second part of the primary key is the row key, specified by the RowKey property. The row key is a unique identifier for an entity within a given partition. Together the PartitionKey and RowKey uniquely identify every entity within a table.
Timestamp Property
The Timestamp property is a DateTime value that is maintained on the server side to record the time an entity was last modified. The Table service uses the Timestamp property internally to provide optimistic concurrency. The value of the Timestamp property for an entity advances each time the entity is modified. This property should not be set on insert or update operations (the value will be ignored).
The row key is a string value that may be up to 1 KiB in size.
You must include the RowKey property in every insert, update, and delete operation.
Ok, extend the logic app and apply a business case.
- When an order is submitted or changed
- Put a message on a queue
- Insert entity in a table
The blob and queue connectors we have talked about before.
Azure Table storage actions
We will use the insert Entity, which takes a JSON object and Entity and you must provide PartitionKey and the RowKey as mentioned above, you can include other custome JSON fields.
We have included File: with a dynamic content and RowKey with a function.
So let’s edit a order and then run the trigger for the logic app
Run the trigger and view the queue (the msg in already in the queue since we just edited it, if we upload a new, a new msg will come)
Then view the table in Storage explorer:
Powershell
Perform Azure Table storage operations with PowerShell | Microsoft Learn
https://learn.microsoft.com/en-us/azure/storage/tables/table-storage-how-to-use-powershell
Install-Module AzTable
$storageAccountName = "storageaccountname"
$rgName = "rg-name"
$storageAccount = Get-AzStorageAccount -ResourceGroupName $rgName -Name $storageAccountName
$ctx = $storageAccount.Context
# Retrieve a list of tables in the storage account
$tableName = "tablename"
Get-AzStorageTable -Name $tableName -Context $ctx
Name Uri
---- ---
tablename https://storageaccountname.table.core.windows.net/tablename
# Retrieve a reference to a specific table
# To perform operations on a table, you need a reference to the specific table
$storageTable = Get-AzStorageTable -Name $tableName -Context $ctx
# Reference the CloudTable property of a specific table
$cloudTable = $storageTable.CloudTable
# Managing table entities
# Add table entities
$partitionKey1 = "partition1"
$partitionKey2 = "partition2"
Add-AzTableRow `
-table $cloudTable `
-partitionKey $partitionKey1 `
-rowKey ("CA") -property @{"username"="Chris";"userid"=1}
# Retrieve all entities
Get-AzTableRow -Table $cloudTable | ft