def get_mssql_properties(users, host, schema):
    """
    For a list of user tuples, find the first occurrence that matches host and database.

    :param users: list containing a sequence of AT LEAST (host, schema, username, password)
    :param host: the hostname to match
    :param schema: the schema to match
    :return: a dict containing host, schema, username, password, port
    """
    for user in users:
        if user[0].lower() == host.lower() and user[1].lower() == schema.lower(
            ):
            res = {'host': host, 'schema': schema, 'port': user[4] if len(
                user) > 4 else None, 'username': user[2], 'password': user[3]}
            return res
    return None
