✅ Can't Deploy .NET Aspire application using azd in Azure DevOps Pipeline
I am having a very frustrating problem deploying my .NET Aspire application system using
azd deploy
in Azure DevOps. I searched the issues and I tried these steps that I found, but to no avail:
- create a pipeline variable called AZD_INITIAL_ENVIRONMENT_CONFIG
- copy the contents of the .azure/<env_name>/config.json
file into it
- reference the variable in the YAML, like this:
However, I still get the same error when the pipeline runs azd deploy
:
ERROR: failed deploying service 'account-service': failed executing template file: template: manifest template:27:19: executing "manifest template" at <securedParameter "CacheConnection">: error calling securedParameter: parameter CacheConnection not found
I even added a step to echo out the contents of the environment variable, and all looks fine with it. I also tried creating the AZDO pipeline using azd pipeline config --provider azdo
. It created the AZD_INITIAL_ENVIRONMENT_CONFIG variable for me, but I still get the same error . Deploying from the command line works fine btw.18 Replies
it seems that the CacheConnection is missing
But it isn't. Also, azd deploy from the command line works fine.
I verified that the CacheConnection is defined in the JSON I put into the AZD_INITIAL_ENVIRONMENT_CONFIG environment variable
maybe its invalid?
The step that echos out that variable clearly shows it is present
Nope, as I say, deploying from the command line works fine.
I even got azd to create the pipeline for me, using
azd pipeline config --provider azdo
and that created the variable automatically. That pipeline also fails with the exact same message
So its something a bit deeper I fearhttps://learn.microsoft.com/en-us/azure/azure-cache-for-redis/cache-troubleshoot-connectivity is this relevant?
Troubleshoot connectivity in Azure Cache for Redis - Azure Cache fo...
Learn how to resolve connectivity problems when creating clients with Azure Cache for Redis.
This ask for help is not about connectivity to REDIS, sorry.
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
This is by far the most frustrating part
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
The way azd works with cd pipelines
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
I'll see what I can do about making something visible to all, but its not an easy ask
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
From the debugging I've done, it seems to me that
azd provision
and azd deploy
ignore the contents of the env var AZD_INITIAL_ENVIRONMENT_CONFIG
. I have verified that, even when that var is a pipeline secret, it does contain all the values needed. But azd
just says they are not set... Here's a bit more information:
When I run the pipeline, the Provision step fails with the error:
ERROR: initializing provisioning manager: prompting for value: no default response for prompt 'Enter a value for the 'AADB2CClientId' infrastructure parameter:'
However, the pipeline step DEBUG: print AZD_INITIAL_ENVIRONMENT_CONFIG
for debugging printed out the value of the AZD_INITIAL_ENVIRONMENT_CONFIG
and it definitely contains the infrastructure parameters e.g.
This issue is SOLVED! The problem was that I had run
azd init
and azd pipeline config
in the AppHost folder. As soon as I ran those commands in the root of the solution, and adjusted the pipeline to remove the cd $(Build.SourcesDirectory)/ServiceLayer.AppHost;
lines, it all worked like a charm 🙂$close
If you have no further questions, please use /close to mark the forum thread as answered