-
Notifications
You must be signed in to change notification settings - Fork 608
Unclear how to add and manage secrets #8824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Yea this part of aspire + azd is really messy. Anything defined in the app host's configuration is used for development not deployment. |
cc @vhvb1989 This is something we should spend some time on. |
I'm not really sure that secrets should ever be pushed from your local environment to the deployed environment by default. That should be an explicit operation with potentially different values from whatever was in user secrets. I can see the argument being that maybe azd provision/deploy is about moving from local dev to remote dev so it can use the same values. |
This. I'm using the Publish feature from Visual Studio, and when i create a new Environment, the IDE prompt me for the Parameters value, which are stored then in the config.json file in the .azure/ folder. After that, when i deploy the aspire solution to ACA (both from right click > Publish and running azd up), the only Parameters used are the ones from the AppHost appsettings.Development.json, not even the appsettings.json are being considered. Can we shed some light on this? It gets tiring replacing manually some configured secrets every time. |
Can you clarify what you mean by this? azd should be using config.json for parameter values, are you seeing something different? |
I made some test, here's what i found:
Let me know how i can supply you better insights to understand the issue! |
@bradygaster @vhvb1989 do the parameters in visual studio come from appsettings.json somehow? I don't see how that can happen unless VS is explicitly reading them from there and giving those values to azd. |
@davidfowl if you can express this in the manifest, AZD can take the user-secrets from dotnet during deployment. For example: "param-to-user-secret": {
"type": "parameter.v0",
"value": "{param-to-user-secret.inputs.value}",
"inputs": {
"value": {
"type": "string",
"secret": true,
"default":{
"value": "{dotnet.user-secrets.secret-name}"
}
}
}
} This would be telling anyone deploying that the |
Is there an existing issue for this?
Describe the bug
After an initial deployment I added a couple of secrets to a project, following this doc https://learn.microsoft.com/en-us/dotnet/aspire/fundamentals/external-parameters
accesskey1
andaccesskey2
Parameters in AppHost's appsettings.jsondotnet user-secrets set "Parameters:accesskey1" "..."
anddotnet user-secrets set "Parameters:accesskey2" "..."
azd deploy
The deployment kept failing with:
After trying different approaches, I ran
azd provision
and it prompted for the two secrets, updating.azure/{envname}/config.json
, adding the two new entries:My deployment doesn't include any AKV. The vault is stored locally on my workstation, under
~/.azd/vaults/11073122-0831-4cba-9ed8-17ec4360fde8.json
, where the secrets are saved in base64 format:azd deploy
is reading secrets from this file and ignoring those set withdotnet user-secrets
, which seems to deviate from the documentation.Additionally,
azd env set-secret "accesskey1"
prompts for a KeyVault from Azure, rather than updating this local file.I haven't found how to update these secrets with
azd
so I'm editing the vault file manually encoding/decoding these base64 values.Forcing values
FYI, I tried this but the values are ignored. The secrets in Azure portal are the values coming from AZD vault:
.NET Version info
azd version 1.14.0 (commit c928795c47f27d1e997c217147dc649054ac05c8)
dotnet 9.0.202
Aspire.AppHost.Sdk 9.1.0
The text was updated successfully, but these errors were encountered: