I have an Azure DevOps Deployment Pipeline with an Azure PowerShell Script Task.
The script task populates an Azure Storage Table. It gets the data from a json file.
Unfortunately, my client keeps on changing their mind with what they want in the table.
So, I thought the best thing to do would be to delete the table, recreate it and repopulate it with the new data.
But, I get a conflict error if I run the Remove and Create back-to-back. Which makes sense since it seems so much of Azure uses a messaging architecture.
Anyway, does anyone have a solution to this issue? I have a few, but they seem jerry-rigged.
Here a subset of the codde:
$storageAccount = Get-AzStorageAccount -ResourceGroupName $ResourceGroupName -AccountName $StorageAccountName
$storageTable = Get-AzStorageTable `
-Name $tableName `
-Context $storageAccount.Context `
-ErrorVariable ev `
-ErrorAction SilentlyContinue
if($storageTable) {
Remove-AzStorageTable -Name $tableName -Context $storageAccount.Context -Force
}
New-AzStorageTable -Name $tableName -Context $storageAccount.Context
$storageTable = Get-AzStorageTable -Name $tableName -Context $storageAccount.Context
Any suggestions would be appreciated.