I have opened the new thread as requested.I believe you have the script with you which I shared in the previous forum.Please consider that script and find the below requirement.
function Add-Entity()
{
[CmdletBinding()]
param
(
$table,
[string] $partitionKey,
[string] $RowKey,
[string] $Label_Value,
[string] $Lable_cost
)
$entity = New-Object -TypeName Microsoft.WindowsAzure.Storage.Table.DynamicTableEntity -ArgumentList $partitionKey, $rowKey
$entity.Properties.Add("Label_Value",$Label_Value)
$entity.Properties.Add("Label_Value",$Lable_cost)
$result = $table.CloudTable.Execute([Microsoft.WindowsAzure.Storage.Table.TableOperation]::Insert($entity))
}
$tableName = "TestTable"
$subscriptionName = "Tech Enabled Solutions"
$resourceGroupName = "abc"
$storageAccountName = "defghi"
$location = "North Central US, South Central US"
# Get the storage key for the storage account
$StorageAccountKey = "12345678"
# Get a storage context
$ctx = New-AzureStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageAccountKey
# Get a reference to the table
$table = Get-AzureStorageTable -Name $tableName -Context $ctx -ErrorAction Ignore
$csv = Import-CSV "d:\a\1\s\DeploymentScripts\TestTable.csv"
ForEach ($line in $csv)
{
Add-Entity -Table $table -partitionKey $line.partitionkey -rowKey $line.RowKey -Label_Value $line.Label_Value Lable_cost $line.Lable_cost
}
My assumption is like,if I can pass files as a parameters in the script and it will read that file and can insert and delete the data for that particular file into azure storage.but the thing is currently I am inserting data using this command in the power shell script...
$csv = Import-CSV "d:\a\1\s\DeploymentScripts\TestTable.csv" currently as per the script it is testtable.csv
if I want to pass different file say like testtable2.csv to the powershell script,I can't write 2nd script and keep in VSTS repo right as there are many csv files I need to deploy into azure storage.so at the run time of script how can I pass different files using one script which i am currently running. how can I implement the script and how can I pass parameters.
One more doubt pal, how can I deploy multiple csv files into table storage as each csv file data is different in rows and columns and will have extra rows and extra columns for each csv file.So how can I automate/implement/change the above script for deploying multiple csv files using power shell script as not every csv file having same columns right,some may csv files have 3 fields and some csv files have 5,6,7 and so on fields..I hope you understand my requirement.Please help me out.