I am trying to understand the way to globalize the notion of variety. Let $\mathcal A$ be a quasi-coherent sheaf locally of finite type over an affine variety $X$. We define a variety $Y=\mathrm{Specm}_X(\mathcal A)$ together with a morphism $\pi:Y\rightarrow X$, dual to the structural morphism $\mathcal O_X(X)\rightarrow\mathcal A(X)$. For any $f\in\mathcal O_X(X)$, since $\mathcal A$ is quasi-coherent, we have $$ \mathcal A(D(f))=\mathcal A(X)\otimes_{\mathcal O_X(X)}\mathcal O_X(U). $$ So $\mathrm{Specm}(\mathcal A(D(f))$ is identified with $\pi^{-1}(D(f))$.
I don't understand why we have this identification.
Thank you in advance!