<@ULVA73B9P> if using the self-hosted prefect serv...
# ask-marvin
p
@Marvin if using the self-hosted prefect server on an Azure Container Instance, how will the worker container authenticate to the server?
m
thought for 284.6 seconds
n
you can either set the env vars for the process directly
PREFECT_API_URL=.... PREFECT_AUTH_STRING=... prefect worker start
or set
~/.prefect/profiles.toml
on the worker machine and
prefect --profile my-worker-profile worker start ...
m
Short answer: it depends on whether you enable auth on your self-hosted Server. - No auth (default): Workers just need
PREFECT_API_URL
pointing to your Server’s API, e.g.
http://<host>:4200/api
. No API key is required or used by OSS Server. - With auth enabled: If you set
PREFECT_SERVER_API_AUTH_STRING="user:pass"
on the Server, then workers must send the same credentials via
PREFECT_API_AUTH_STRING="user:pass"
. The client will use HTTP Basic auth automatically. Typical env for a worker container (e.g., in Azure Container Instances):
Copy code
# No auth (default server)
PREFECT_API_URL=<http://your-server:4200/api>

# If you enable server auth
PREFECT_API_URL=<http://your-server:4200/api>
PREFECT_API_AUTH_STRING=user:pass
Start the worker:
Copy code
prefect worker start -p your-work-pool
Notes - Do not use
PREFECT_API_KEY
with self-hosted Server; that’s for Prefect Cloud. - When a worker submits flow runs, it propagates its Prefect settings (including
PREFECT_API_URL
and auth) into the flow-run environment, so your flows can talk back to the same Server. - If your Server is exposed publicly, consider putting it behind TLS and enabling basic auth. Docs and references - Security settings (basic auth for self-hosted): Security settings - Settings reference (env vars): Settings reference - Workers overview: Workers - Self-hosted server CLI: Self-hosted server CLI If you plan to enable basic auth on your ACI-hosted Server, I can share a concrete
az container create
example with the right environment variables for both the Server and the Worker—would that help?