Azure has some pretty strict internal requirements around resource creation that make this possible. Every service must provide a "Resource Provider"[0] API that supports idempotent creation operations and standardized query patterns for read operations. Whether you create a resource through an ARM template, in the portal, or via the CLI, it's going through the same unified API surface.
So, there is definitely still state, it's just stored centrally.
[0]: https://docs.microsoft.com/en-us/azure/azure-resource-manage...