essenbee
essenbee
CC#
Created by essenbee on 1/28/2025 in #help
✅ 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:
- task: AzureCLI@2
displayName: Deploy Service Layer Core
inputs:
azureSubscription: azconnection
scriptType: bash
scriptLocation: inlineScript
keepAzSessionActive: true
inlineScript: |
cd $(Build.SourcesDirectory)/ServiceLayer.AppHost;
ls -la;
azd deploy --no-prompt --environment $(AZURE_ENV_NAME);
env:
AZURE_SUBSCRIPTION_ID: $(AZURE_SUBSCRIPTION_ID)
AZURE_ENV_NAME: $(AZURE_ENV_NAME)
AZURE_LOCATION: $(AZURE_LOCATION)
AZD_INITIAL_ENVIRONMENT_CONFIG: $(AZD_INITIAL_ENVIRONMENT_CONFIG)
- task: AzureCLI@2
displayName: Deploy Service Layer Core
inputs:
azureSubscription: azconnection
scriptType: bash
scriptLocation: inlineScript
keepAzSessionActive: true
inlineScript: |
cd $(Build.SourcesDirectory)/ServiceLayer.AppHost;
ls -la;
azd deploy --no-prompt --environment $(AZURE_ENV_NAME);
env:
AZURE_SUBSCRIPTION_ID: $(AZURE_SUBSCRIPTION_ID)
AZURE_ENV_NAME: $(AZURE_ENV_NAME)
AZURE_LOCATION: $(AZURE_LOCATION)
AZD_INITIAL_ENVIRONMENT_CONFIG: $(AZD_INITIAL_ENVIRONMENT_CONFIG)
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.
30 replies