How do we store secrets using Prefect Cloud? I can...
# ask-community
m
How do we store secrets using Prefect Cloud? I can't find anything in the UI.
k
Hey @Madison Schott, it’s under the “Team” tab. You’ll find “Scerets”
m
If I've put a secret in my config.toml file how do I then reference it in the file with my flow?
Or I guess also if you define it in UI
k
You would pull it like this in the flow.
Copy code
from prefect import task, Flow, Parameter
import prefect
from prefect.tasks.secrets import PrefectSecret

@task
def abc(x):
    logger = prefect.context.get("logger")
    <http://logger.info|logger.info>(f"{x}")
    return x

se = PrefectSecret()

with Flow("param-test") as flow:
    y = PrefectSecret("FOO_FOO")
    abc(y)