Azure / azure-dev

A developer CLI that reduces the time it takes for you to get started on Azure. The Azure Developer CLI (azd) provides a set of developer-friendly commands that map to key stages in your workflow - code, build, deploy, monitor, repeat.
https://aka.ms/azd
MIT License
410 stars 198 forks source link

[Issue] AZD github actions pipeline sample doesn't work out of box #4514

Open AquaNerd opened 1 week ago

AquaNerd commented 1 week ago

When Using the following azd init command from github actions I receive an error message.

Command: azd init --from-code 1 -e ${{ env.AZURE_ENV_NAME }} -s ${{ env.AZURE_SUBSCRIPTION_ID }} -l ${{ env.AZURE_LOCATION }}

Error: '' is not an allowed choice. allowed choices: Confirm and continue initializing my app,Cancel and exit

The entire reason I am running this is because if I do not include the init command then I receive "no project exists; to create a new project, run azd init" when running the provision command.

rajeshkamal5050 commented 1 week ago

@v-xuto can you triage this and update findings? cc @vhvb1989

zedy-wj commented 1 week ago

@AquaNerd - Please confirm whether the azure.yaml file exists in the path when you running the provision command. The error "no project exist" is usually because it cannot recognize that your current template is supported by azd. Generally, when using the azd provision command, the infra folder and the azure.yaml (configuration file that maps your application services to the provisioned infrastructure resources) file need to exist. For details: https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/make-azd-compatible?pivots=azd-convert#template-creation-concepts

If not, could you provide more specific information, such as sharing your template or specific implementation in GitHub workflow, so that we can reproduce this issue?

vhvb1989 commented 1 week ago

@AquaNerd , are you trying to deploy some .NET Aspire project in CI/CD ?
If you have your azure.yaml inside the AppHost folder, you need to cd to the AppHost folder before running azd provision.