How can I force Prefect to use Cloud secrets rather than the local secrets?

Flow runs triggered by an agent will pull Cloud secrets by default. If you want to pull Cloud secrets during a local development (e.g. using the CLI or flow.run()), you can export the environment variable:

export PREFECT__CLOUD__USE_LOCAL_SECRETS=false

or you can configure it in the config.toml:

[cloud]
use_local_secrets = false

Setting this on an agent

If you need to set it on your agent:

prefect agent XXX start --env PREFECT__CLOUD__USE_LOCAL_SECRETS=false

Or when you use Kubernetes agent via a YAML file:

    spec:
      containers:
      - args:
        - prefect agent kubernetes start
        command:
        - /bin/bash
        - -c
        env:
        - name: PREFECT__CLOUD__USE_LOCAL_SECRETS
          value: false