Search code examples
azurepowershellazure-functionsazure-storage

Azure Function - Powershell and Azure storage table (INSERT OR REPLACE)


I usually use node to write my function but this was required to be in powershell.

I'm trying to write data in the Azure storage Table, but if data exists it will not replace it with the following code:

Push-OutputBinding -Name outputTable -Value @{
                    PartitionKey = $PartitionKey
                    RowKey = $RowKey
                    Description = $description
        }

I've been looking everywhere (docs and google) but I cannot find the method to replace the content of a row if the row exists, basically I would like to perform the same insert of replace that I have in node.

Thank you for your help!


Solution

  • Used https://learn.microsoft.com/en-us/azure/storage/tables/table-storage-how-to-use-powershell#updating-entities suggested by Mike in my post comment!

    Works in foreach loop, be carefull if you use regex for match.