Publish from outside Snowflake

These instructions help you publish from your development environment into a Posit Connect installation managed by the Posit Team Native App hosted in Snowflake Snowpark Container Services (SPCS).

These instructions only apply when your development environment is NOT also hosted in Snowflake. Use the instructions in Publish from within Snowflake when both Workbench and Connect are Snowflake-hosted.

Before getting started, visit your Connect installation and provision an API key. Use that API key to configure your Connect account in Workbench.

Snowflake credentials

Snowflake clients discover information about configured connections from well-known locations. You can use the SNOWFLAKE_HOME environment variable to override the location used by default.

  • macOS: ~/.snowflake/
  • Linux: ~/.config/snowflake/

These steps assume you are working on macOS and have not already set up a Snowflake connection file using key-pair authentication. Otherwise, you can use your existing connections to publish to Connect within Posit Team.

Terminal
# Create a directory for your configuration.
mkdir -p ~/.snowflake/
cd ~/.snowflake/

# Create an empty connections.toml with appropriate permissions.
touch connections.toml
chmod 600 connections.toml

# Create public/private key files.
openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out rsa_key.p8 -nocrypt
openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pub
chmod 600 rsa_key.p8
# Copy your public key contents
grep -v '\-' rsa_key.pub | pbcopy

The pbcopy command added the contents of your public key into your clipboard. Send that text to your Snowflake administrator; they will use it when configuring key-pair authentication for your account.

Add the following snippet into the connections.toml file you just created.

connections.toml
[default]
account = "<account-id>"
user = "<first.last@example.co>"
role = "PUBLIC"
authenticator = "SNOWFLAKE_JWT"
private_key_file = "/absolute/path/to/.snowflake/rsa_key.p8"

Once you confirm your public key has been added by your Snowflake administrator, run the following command (which will require that you have uv installed):

Terminal
uvx --from snowflake-cli snow connection test

rsconnect-python

rsconnect-python is a Python package used to deploy content to Posit Connect. It uses your configured Snowflake connections when interacting with a Connect instance hosted in Snowflake.

First, install the rsconnect-python package.

Terminal
# Note: The rsconnect-python PyPI release does fully support
# SPCS authentication.
python -m pip install "rsconnect-python[snowflake] @git+https://github.com/posit-dev/rsconnect-python"

Next, configure your Connect account. These commands assume that you have a Snowflake connection named “default”.

Terminal
rsconnect add \
          --server "https://<instance-id>-<account-id>.snowflakecomputing.app" \
          --name "spcs" \
          --api-key "your-connect-api-key" \
          --snowflake-connection-name "default"

Last, deploy your content.

Terminal
rsconnect deploy shiny -n spcs "/path/to/app"

rsconnect

rsconnect is an R package used to deploy content to Posit Connect. It uses your configured Snowflake connections when interacting with a Connect instance hosted in Snowflake.

First, install the rsconnect package.

R console
# Note: The rsconnect CRAN release does fully support
# SPCS authentication.
remotes::install_github("rstudio/rsconnect")

Next, configure your Connect account. These commands assume that you have a Snowflake connection named “default”.

R console
rsconnect::addServer(
  "https://<instance-id>-<account-id>.snowflakecomputing.app", 
  name = "spcs", 
  snowflakeConnectionName = "default"
)

rsconnect::connectSPCSUser(
  server = "spcs",
  apiKey = "my-api-key",
  snowflakeConnectionName = "default"
)

Last, deploy your content. This command assumes that the target content is in the current working directory.

R console
rsconnect::deployApp(server = "spcs")

Publisher (Positron, VS Code)

Posit Publisher is a VS Code extension that can be used with Positron or VS Code to deploy to Posit Connect. It is available for download and installation from the extensions marketplace.

  • Install the Publisher extension (version > 1.16.0).
  • When deploying your project, use the https://<instance-id>-account-id>.snowflakecomputing.app/ Snowflake URL for your Connect instance along with your Connect API key.

Your local connections.toml configuration is used to authenticate with the Snowflake proxy, while your Connect API key allows publishing to Connect.

Back to top