azure-dev: "Azd init" failed for todo-java-postgresql-terraform on CodeSpace

Describe the issue: Authentication failed for todo-java-postgresql-terraform when run azd init

The error message as follows: image

Repro steps:

  1. Run azd auth login
  2. Run azd init -t todo-java-postgresql-terraform

Environment: OS: CodeSpace in VS Code. Template: https://github.com/Azure-Samples/todo-java-postgresql-terraform Azd version: 0.9.0-beta.2-daily.2772915 (commit https://github.com/Azure/azure-dev/commit/08ff66607eb70b25d189aefce0d21070fe84630d)

Expected behavior: Run command azd init -t todo-java-postgresql-terraform success.

@rajeshkamal5050 for notification.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 26 (24 by maintainers)

Most upvoted comments

Repo is now public and codespaces can be created from it

@v-xuto , I created this PR: https://github.com/Azure/azure-dev/pull/2597

This should push a new version for https://github.com/Azure-Samples/todo-java-postgresql-terraform (on stagging branch) which you can test

I can add this line to the terraform templates from Azure-dev (https://github.com/Azure/azure-dev/blob/main/templates/common/.azdo/pipelines/terraform/azure-dev.yml), and @fangjian0423, cand you do this for the terraform templates out of azure-dev?

Thanks @vhvb1989 , we don’t have any terraform templates out of azure-dev.

Could you pls help to apply the modifications on https://github.com/Azure/azure-dev/blob/main/templates/common/.github/workflows/java/terraform/azure-dev.yml in your PR, I think it may no need for me to create a new PR to fix this.

@fangjian0423 , you need to make sure that az and azd are both using the same subscription/account.

Looking at the error you are getting, az is using the sub: image

I don’t recognize this sub-id.

Run az account show to see more about that subscription. (az sets the subscription/account when you log in). Then run az account set --subscription xxxxxx-xxxxxx-xxx to match the same sub that azd is using. That should resolve this issue.

@v-xuto I created a PR https://github.com/Azure/azure-dev/pull/2556 to update java-postgresql template, could you please help to test it, thanks!

Before you test it, I have a question about all the terraform templates. I notice that https://github.com/Azure/azure-dev/pull/2034 disable basic auth, and the pipeline runs successful in my postgresql update PR, but the templates run failed in my local or GHA action.

Did I miss something (When I remove the code of basic auth in my local, it runs successful)?

image

sure, we will continue work on them @rajeshkamal5050

@fangjian0423 @yiliuTo before making the repo public and make it work for CodeSpaces.

  • Can we make adjustments to consume GHA action and Azd DevContainer features?
  • Get it added to the azd init list of templates?
  • Can we test and make sure it works fine? Since, it has been sometime its been added.

For any help with testing or making adjustments w.r.t to GHA action and Azd DevContainer feature. You can work with @v-xuto