- 
                Notifications
    
You must be signed in to change notification settings  - Fork 260
 
Description
azd version 1.11.1 (commit ae08ceb)
I have a .NET Aspire application that I can provision and deploy into Azure using azd provision and azd deploy when I run these commands locally on the command line. However, these commands fail when run as part of an Azure DevOps Pipeline.
I created the Azure Devops Pipeline in the following manner:
- ran 
azd pipeline config --provider azdo - entered secrets and other params when prompted
 - updated the 
azure_dev.ymlfile to the following and committed: 
# Run when commits are pushed to master
trigger: none
pool:
  vmImage: ubuntu-latest
steps:
  # setup-azd@0 needs to be manually installed in your organization
  # if you can't install it, you can use the below bash script to install azd
  # and remove this step
  - task: setup-azd@0
    displayName: Install azd
  # azd delegate auth to az to use service connection with AzureCLI@2
  - pwsh: |
      azd config set auth.useAzCliAuth "true"
    displayName: Configure AZD to Use AZ CLI Authentication.
  # DEBUG: print AZD_INITIAL_ENVIRONMENT_CONFIG for debugging
  - task: PowerShell@2
    displayName: Show var for debugging
    inputs:
      targetType: "inline"
      script: |
        Write-Host ($env:var1).substring(0,1);
        Write-Host ($env:var1).substring(1);
    env:
      var1: $(AZD_INITIAL_ENVIRONMENT_CONFIG)
  # Install .NET 9.0 SDK
  - task: UseDotNet@2
    displayName: Install .NET 9.0 SDK
    inputs:
      packageType: 'sdk'
      version: '9.0.x'
      installationPath: $(Agent.ToolsDirectory)/dotnet
  # Restore dependencies
  - task: DotNetCoreCLI@2
    displayName: Restore dependencies
    inputs:
      command: "restore"
      projects: "./ServiceLayerCore.sln"
      feedsToUse: "config"
      nugetConfigPath: "./NuGet.Config"
  # Build the project
  - task: DotNetCoreCLI@2
    displayName: Build Service Layer Core
    inputs:
      command: "build"
      projects: "./ServiceLayerCore.sln"
      arguments: "--configuration Release"
  - task: AzureCLI@2
    displayName: Provision Infrastructure
    inputs:
      azureSubscription: azconnection
      scriptType: bash
      scriptLocation: inlineScript
      keepAzSessionActive: true
      inlineScript: |
        cd $(Build.SourcesDirectory)/ServiceLayer.AppHost;
        azd provision --no-prompt
    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 Application
    inputs:
      azureSubscription: azconnection
      scriptType: bash
      scriptLocation: inlineScript
      keepAzSessionActive: true
      inlineScript: |
        cd $(Build.SourcesDirectory)/ServiceLayer.AppHost;
        azd deploy --no-prompt;
    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)
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.
No matter what I do, the pipeline always fails with the same error. It looks like azd is ignoring the values in the environment variable.
Any help on this would be gratefully received as this is currently blocking any progress I can make productionizing my application.
