-
I'm using preview 4 and trying to add a sql connection to an existing database (happens to be an Azure VM). I've added
And then on my project:
This is fine running locally, reading the connection string from the AppHost secrets. However, if you do an azd deploy, or run azd in your Azure DevOps pipeline, it asks for this connection string as a parameter. e.g. this in the prompt after 'azd deploy': ? Enter a value for the 'sql' infrastructure secured parameter: I was hoping instead it would use an environment variable (e.g. SQL_CONNECTION), I'm not sure how I supply this parameter at build time in the Azure devops pipeline? Is there a way to tell it to get this connection string from environment variable instead (was hoping it would use 'SQL_CONNECTION' from above)? Or am I just going about this the wrong way? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
See https://learn.microsoft.com/en-us/dotnet/aspire/whats-new/preview-4#prompting-for-parameters |
Beta Was this translation helpful? Give feedback.
-
Thanks, for that, got this all working. As a small thing, it would be good if there where a prompt some where, perhaps in the Because the second parameter to AddConnectionString is 'environmentVariableName', I thought that was what it would be looking for as an input, but I guess it's just what the output variable name is on the container app. Maybe that argument should also determine what azd calls it in the main.parameters.json? (btw: I like the 'enrich' change as a way of augmenting the dbContext, prefer that to how it was) |
Beta Was this translation helpful? Give feedback.
-
Issue filed here: Azure/azure-dev#3597 |
Beta Was this translation helpful? Give feedback.
Thanks, for that, got this all working. As a small thing, it would be good if there where a prompt some where, perhaps in the
<summary>
comment on 'AddConnectionString', or on azd where it says 'enter a value for sqlConnection' perhaps it could output '(alternatively create an environment variable called AZURE_SQL_CONNECTION)'.Because the second parameter to AddConnectionString is 'environmentVariableName', I thought that was what it would be looking for as an input, but I guess it's just what the output variable name is on the container app. Maybe that argument should also determine what azd calls it in the main.parameters.json?
(btw: I like the 'enrich' change as a way of augmenting th…