Scripts/Write-ChangeLog.ps1
function Write-ChangeLog { [CmdletBinding()] param( [Parameter(Mandatory=$true)] [string]$Account, [Parameter(Mandatory=$true)] [string]$SafeName, [Parameter(Mandatory=$true)] [string]$MTR, [Parameter(Mandatory=$true)] [Boolean]$xml_copied, [Parameter(Mandatory=$true)] [Boolean]$room_rebooted, [Parameter(Mandatory=$true)] [String]$tableName_log ) $date = Get-Date -Format "MM_dd_yyyy_mm_ss" $RowKey = $Account + $date #get contex of logs table $StorageKey=(Get-AzStorageAccountKey -ResourceGroupName $resourceGroup -Name $storageAccount).Value[0] $ctx = New-AzStorageContext -StorageAccountName $storageAccount -StorageAccountKey $StorageKey $cloudTable = (Get-AzStorageTable –Name $tableName_log –Context $ctx).CloudTable $add_row = Add-AzTableRow -table $cloudTable -partitionKey $SafeName -RowKey $RowKey -property @{"userID"=$Account;"safeName"=$SafeName;"MTR"=$MTR;"xml_copied"=$xml_copied;"room_rebooted"=$room_rebooted} if($add_row.HttpStatusCode -eq 204){ return $true } else { return $false } } |