Before you publish a workbook that relies on an Analytics Extensions connection to Tableau Server, you should verify that the server is configured to be able to run scripts, and also configure Tableau Server to have its own Analytics Extensions connection. See “Configure Connection to Analytics Extensions” (Windows or Linux) in the Tableau Server Help.
Analytics Extensions can (as of Tableau 20.4) now be published in Tableau Cloud! See more information here: Cloud Documentation