2 Edited to point out that these are associative structures.

[Edit: Thanks to Harry Gindi for pointing out that I'm only extending the notion of an associative algebra.]

Here is a somewhat "brute force" approach to define an associative algebra over a general ring. Let's say that a ring $A$ with a fixed ring homomorphism $f\colon R\to A$ is centrally generated over $R$ (with respect to $f$) if $A$ is generated as a ring by the image of $R$ and a subset $X\subseteq A$ such that every element of the image of $R$ commutes with every element of $X$.

Then it's clear that whenever $R$ is commutative, a ring homomorphism $f\colon R\to A$ makes $A$ into an $R$-algebra if and only if $A$ is centrally generated over $R$ with respect to $f$.

1

Here is a somewhat "brute force" approach. Let's say that a ring $A$ with a fixed ring homomorphism $f\colon R\to A$ is centrally generated over $R$ (with respect to $f$) if $A$ is generated as a ring by the image of $R$ and a subset $X\subseteq A$ such that every element of the image of $R$ commutes with every element of $X$.

Then it's clear that whenever $R$ is commutative, a ring homomorphism $f\colon R\to A$ makes $A$ into an $R$-algebra if and only if $A$ is centrally generated over $R$ with respect to $f$.