Hi prefect community! I'm new to prefect and canno...
# ask-community
m
Hi prefect community! I'm new to prefect and cannot figure out why secrets don't work for me. I'm using windows. I have env var set "PREFECT__CONTEXT__SECRETS__AZURE_DEMO="DefaultEndpointsProtocol=https;AccountName=.... ", but when running code
Copy code
from prefect.tasks.azure.blobstorage import (
    BlobStorageDownload
)

storage = BlobStorageDownload(azure_credentials_secret="AZURE_DEMO", 
                              container="mycontainer")

storage.run(blob_name="demo")
I'm getting
Copy code
ValueError: Local Secret "AZURE_DEMO" was not found.
I tried setting AZURE_DEMO in config.toml but getting same result. What am I doing wrong?
a
@Maria are you using Prefect Cloud or Server? I suggest to check your config to see if your using local secrets or cloud secrets
m
@ale I'm using Prefect Server; after additional debugging I can see secrets defined in config.toml fine (Yay! 🎉), regardless of the value
use_local_secrets = true (or false);
but cannot get env var to work: I don't see them in
prefect.context.get("secrets", {})
, again regardless of the use_local_secrets. Tried defining them both as user env var and system env var.
I'm happy with using config.toml so going to give up on env var for now. Curious though if other users on Windows had to do anything special to get them to work.
a
Hey @Maria 😊 I see that the value of your secret contains the character
=
. I believe that for using such secrets with
--env
you have to upgrade Prefect to the latest version as mentioned here https://github.com/PrefectHQ/prefect/pull/4160
m
oh that's interesting! thanks!