Public/Test-specAzureTableForErrors.ps1

Function Test-specAzureTableForErrors {
    param(
        [Parameter(Mandatory = $true)]
        $tabledata
    )

    # Check the number of rows returned
    If ($($tabledata).count -gt 1) {
        Write-Host "More than one row returned from Azure table. Please check the data in the table. Only one row should be returned" -ForegroundColor DarkYellow
        return $false
    }

    # Check the StoreType is correct
    if (($tabledata.storeType -ne 'n') -and ($tabledata.storetype -ne 'h')) {
        Write-Host "Invalid entry in Azure table for StoreType. Please use only 'n' or 'h'" -ForegroundColor DarkYellow
        return $false
    }

    # No errors found
    return $true
}